Forum Moderators: open

Message Too Old, No Replies

Dynamic Form

         

NotTwoBright

5:54 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



Does anybody know some javascipt code or where to find it to enable all checkboxes, make them all checked?
For example:

<form name="submit_form" method="post" >

<td><input type="checkbox" name="submit_print1" class="Print"<td>
<td><input type="checkbox" name="submit_print2" class="Print"<td>
...
<td><input type="checkbox" name="submit_print'X'" class="Print"<td>

<input type="button" onclick=" " value="Select All Delete">

Thanks.

</form>

Trace

6:54 pm on Jul 12, 2005 (gmt 0)

10+ Year Member



A quick search turned this up:

[javascript.internet.com...]

NotTwoBright

1:13 pm on Jul 13, 2005 (gmt 0)

10+ Year Member



I saw solutions like that, but all my name values in my form are all different, they are getting incremented by one at the send of the string. Here is a solution I found.

function checkUncheckAll(theElement, ButtonGroup) {
var theForm = theElement.form, z = 0;
while (theForm[z].type == 'checkbox') {
if (theForm[z].name.indexOf(ButtonGroup) == 0) {
theForm[z].checked = theElement.checked;
}
z++;
}
}