I hope I can explain this in a fashion that you all understand.
I have a form that shows multiple records from a database
Each row has two checkboxes, one is for Active (yes) and one is for Active (no). There are several rows with this same query.
ie:
City - Address - Yes - No - Submit
Right now I have it so that for each row, you need to select either yes or no and then hit submit for each one.
The client wants to be able to select all yes's or all no's at the same time and then a final submit button to append the information into the database.
Here is my code to date.
I have tried
But that didn't work at all.
And of course once they are able to select all, it needs to update all records at the same time.
Any experts have some advice for me?
Thanks
I have a form that shows multiple records from a database
Each row has two checkboxes, one is for Active (yes) and one is for Active (no). There are several rows with this same query.
ie:
City - Address - Yes - No - Submit
Right now I have it so that for each row, you need to select either yes or no and then hit submit for each one.
The client wants to be able to select all yes's or all no's at the same time and then a final submit button to append the information into the database.
Here is my code to date.
Code:
print <<OH;
<form Action="openhouseAdmin.cgi" Method="post" name="frm">
<input type='hidden' name="action" value="activeconfirm2">
<input type='hidden' name="city" value="$input{'city'}">
<tr>
<td><FONT CLASS="BodyBold"> $CityName</FONT></td>
<td><FONT CLASS="BodyBold">$StreetAddress</FONT></td>
OH
if ($Active eq "yes") {
$checkedyes = "checked";
$checkedno = "";
} else {
$checkedno = "checked";
$checkedyes = "";
}
print <<OH;
<td align ="Center"><input type="radio" name="Active" value="yes" $checkedyes></td><td align="center"> <input type="radio" name="Active" value="no" $checkedno></td>
<td align=center><input name="MLSNumber" type="Hidden" value="$MLSNumber">
<input type="Submit" Name="Submit" Value="Change"></form>
</td></tr>
OH
}
I have tried
Code:
<script>
function CheckAll()
{
count = document.frm.elements.length;
for (i=0; i < count; i++)
{
if(document.frm.elements[i].checked == 1)
{document.frm.elements[i].checked = 0; }
else {document.frm.elements[i].checked = 1;}
}
}
function UncheckAll(){
count = document.frm.elements.length;
for (i=0; i < count; i++)
{
if(document.frm.elements[i].checked == 1)
{document.frm.elements[i].checked = 0; }
else {document.frm.elements[i].checked = 1;}
}
}
</script>
<form name="frm">
print <<OH;
<td align ="Center"><input type="radio" name="Active" value="yes" $checkedyes></td><td align="center"> <input type="radio" name="Active" value="no" $checkedno></td>
<td align=center><input name="MLSNumber" type="Hidden" value="$MLSNumber">
<input name="btn" type="button" onclick="CheckAll()" value="Check All">
<input name="btn" type="button" onclick="UncheckAll()" value="Uncheck All">
</form>
OH
But that didn't work at all.
And of course once they are able to select all, it needs to update all records at the same time.
Any experts have some advice for me?
Thanks