| | |
checkbox in an array
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Jun 2008
Posts: 40
Reputation:
Solved Threads: 2
hi, im enim and its my first time to post here in javascript because im into php.
my question is:
1.) Is it possible to have two checkbox in a row (with different value), the one is hidden and if i check the the visible checkbox, the other one will be checked too..
2.) and the scenario above will be in an array like when i have 10 rows..
pls. anyone really need your help thanks
my question is:
1.) Is it possible to have two checkbox in a row (with different value), the one is hidden and if i check the the visible checkbox, the other one will be checked too..
2.) and the scenario above will be in an array like when i have 10 rows..
pls. anyone really need your help thanks
•
•
Join Date: Jun 2008
Posts: 40
Reputation:
Solved Threads: 2
this is what im talking about.. its just a single row.. i need to use it in array (for example 10 rows) but it doesn't work. i know i need some javascript add'l code but i don't know how to continue.
the controller will be the visible..the other two checkbox will be hidden.
thanks in advance.
-enim
the controller will be the visible..the other two checkbox will be hidden.
php Syntax (Toggle Plain Text)
<?php include "dbconn.php";?> <html> <head> <SCRIPT LANGUAGE="JavaScript"> <!-- <!-- Begin function Check(chk) { if(document.myform.Check_ctr.checked==true) { for (i = 0; i < chk.length; i++) chk[i].checked = true ; } else { for (i = 0; i < chk.length; i++) chk[i].checked = false ; } } // End --> </script> </head> <body> <form name="myform" action="<?php echo $_SERVER['PHP_SELF']; ?>" method="post"> <div> <div style="width: 200px; height: 30px"><input type="checkbox" name="Check_ctr" value="yes" onClick="Check(document.myform)"/>controller</div> <div style="width: 200px; height: 30px"> <div style="float: left"><input type="checkbox" name="providername" value="premium"/></div> <div style="float: left"><input type="checkbox" name="id" value="2"/></div> </div> <div style="width: 200px; height: 30px"> <div><input type="submit" name="submit" value="Submit"/></div> </div> </div> </form> </body> </html>
thanks in advance.
-enim
•
•
Join Date: Jun 2008
Posts: 40
Reputation:
Solved Threads: 2
hey guys, i think i just dont know how to expalin my problem.. but its ok now. i have it solved myself. i will post the code just in case someboby need it.
<div class="cellContainer" style="background-color: <?php echo $color;?>">
<div class="button1"><input type="checkbox" id="fld1[<?php echo $i;?>]" name="checkbox[]" value="<?php echo $row['destination']; ?>" onClick="document.getElementById('fld2[<?php echo $i;?>]').checked = document.getElementById('fld1[<?php echo $i;?>]').checked"/></div>
<div class="button1" style="visibility: hidden"><input type="checkbox" id="fld2[<?php echo $i;?>]" name="idprovider[]" value="<?php echo $row['id_provider'];?>"/></div>
-enim
php Syntax (Toggle Plain Text)
//records from database $i = 0; while($row = mysql_fetch_array($result)) {
<div class="button1"><input type="checkbox" id="fld1[<?php echo $i;?>]" name="checkbox[]" value="<?php echo $row['destination']; ?>" onClick="document.getElementById('fld2[<?php echo $i;?>]').checked = document.getElementById('fld1[<?php echo $i;?>]').checked"/></div>
<div class="button1" style="visibility: hidden"><input type="checkbox" id="fld2[<?php echo $i;?>]" name="idprovider[]" value="<?php echo $row['id_provider'];?>"/></div>
php Syntax (Toggle Plain Text)
$i++; }
-enim
•
•
Join Date: Jun 2008
Posts: 40
Reputation:
Solved Threads: 2
php Syntax (Toggle Plain Text)
$i = 0;while($row = mysql_fetch_array($result)){ <div class="cellContainer" style="background-color: <?php echo $color;?>"> <div class="button1"><input type="checkbox" id="fld1[<?php echo $i;?>]" name="checkbox[]" value="<?php echo $row['destination']; ?>" onClick="document.getElementById('fld2[<?php echo $i;?>]').checked = document.getElementById('fld1[<?php echo $i;?>]').checked"/></div> <div class="button1" style="visibility: hidden"><input type="checkbox" id="fld2[<?php echo $i;?>]" name="idprovider[]" value="<?php echo $row['id_provider'];?>"/></div> $i++; }
![]() |
Similar Threads
- checkbox array storage and retrieval (PHP)
- Creating a new array dynamically for checkboxes? (PHP)
- Checkbox array (VB.NET)
- Checkbox Arrays ARGH!! (PHP)
- Get value from checkbox (PHP)
- passing checkbox value to next page (PHP)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: Ajax for XML editing?
- Next Thread: <select onChange=""> problem
| Thread Tools | Search this Thread |
acid2 ajax ajaxexample ajaxhelp ajaxjspservlets animate array automatically beta box browser captchaformproblem cart child close codes column css date debugger decimal dependent design disablefirebug dom download element embed engine enter error events ext file firefox focus form forms frameworks getselection google gwt gxt hiddenvalue highlightedword hint html htmlform ie7 ie8 iframe index java javascript javascripthelp2020 jawascriptruntimeerror jquery jsp jump libcurl listbox maps masterpage math media menu microsoft mimic mp4 onmouseoutdivproblem onmouseover onreadystatechange paypal pdf php player position post problem programming prototype redirect safari scale scriptlets scroll search security select software sql toggle unicode variables w3c web website window windowofwords \n






