Originally posted by bretticus
Alternately, if you enter all checkboxes in with the name of (something similiar) checkboxes[] (i.e ...name='checkboxes[]'...) in your html and make each checkbox value the id of the row you want to update, then you can use something like this instead...
When I use [] in the name, it breaks the javascript I'm using to enable and disable the rows.
<SCRIPT LANGUAGE=\"JavaScript\"><!--
function codename_" . $i . "() {
if(document.settings_form.checkbox[].checked)
{
document.settings_form.threshold_1" . $i . ".disabled=false;
document.settings_form.threshold_2" . $i . ".disabled=false;
document.settings_form.email_1" . $i . ".disabled=false;
document.settings_form.email_2" . $i . ".disabled=false;
}
else
{
document.settings_form.threshold_1" . $i . ".disabled=true;
document.settings_form.threshold_2" . $i . ".disabled=true;
document.settings_form.email_1" . $i . ".disabled=true;
document.settings_form.email_2" . $i . ".disabled=true;
}
}
//-->
</SCRIPT>
<tr>
<td><input type=\"checkbox\" onclick=\"codename" . $i . "()\" name=\"checkbox[]\" value=\"$i\"></td>
<td>$location</td>
<td><input type=\"text\" disabled size=\"10\" name=\"threshold_1". $i ."\" value=\"$db_array[threshold_1]\"></td>
<td><input type=\"text\" disabled size=\"10\" name=\"threshold_2". $i ."\" value=\"$db_array[threshold_2]\"></td>
<td><input type=\"text\" disabled size=\"10\" name=\"email_1". $i ."\" value=\"$db_array[email_1]\"></td>
<td><input type=\"text\" disabled size=\"10\" name=\"email_2_". $i ."\" value=\"$db_array[email_2]\"></td>
</tr>
Any suggestions?