| | |
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 |
Tag cloud for JavaScript / DHTML / AJAX
ajax ajaxcode ajaxhelp animate api automatically beta boarder box bug calendar card checkbox child class column cookies createrange() css cursor dependent disablefirebug dom download dropdown editor element engine error events explorer ext file firehose flash form forms game google gwt html htmlform ie8 iframe image() images internet java javascript jawascriptruntimeerror jquery jsf jsfile jump math matrixcaptcha microsoft mimic mp3 mysql object offline onmouseoutdivproblem onreadystatechange parent passing pdf php player post problem progressbar rated rating regex runtime scroll search select session shopping size sql star stars stretch text textarea twitter validation w3c web website window windowofwords windowsxp wysiwyg xml xspf \n






