Hi,
I need some javascript to select all the radio buttons of a group (Select All button). I think some javascript is needed for this, however I am not able to find any javascript for this.
The code is
The name field in the radio buttons property is dynamically generated through query results.
I have written the javascript code populateFields, however it doesn't seem to work.
Appreciate any help in this regards.
Thanks,
Tewari
I need some javascript to select all the radio buttons of a group (Select All button). I think some javascript is needed for this, however I am not able to find any javascript for this.
The code is
Code:
<html>
<head>
<script language = javascript>
function populateFields(thisform)
{
//document.write(document.testing.elements[0].id.checked);
//for( i = 0; i < document.testing.elements.length; i++ )
//{
if(document.testing.delgroup.checked == true)
{
//document.write(document.testing.elements[0].id);
for(i=0; i< document.testing.elements[0].value.length; i++)
{
//document.write(document.testing.elements[0].value.length);
//document.write(document.testing.elements[i].value);
if(document.testing.elements[i].value == document.testing.elements[0].value)
{
document.testing.elements[i].checked = true;
}
}
}
else
document.testing.elements[0].checked = false;
if(document.testing.sendtomegroup.checked == true)
document.testing.elements[1].checked = true;
else
document.testing.elements[1].checked = false;
if(document.testing.spamgroup.checked == true)
document.testing.elements[2].checked = true;
else
document.testing.elements[2].checked = false;
//}
}
</script>
</head>
<Body>
<?
print "<form name=\"testing\" method=\"post\" action=\"radiotestaction.php\" onsubmit=checkval(this.form)>";
echo "<table><tr><th>Delete</th><th>Send To Me</th><th>Report As Spam</th></tr><tr><td><input type = radio name=\"12345\" value=\"del\" id = \"one\"></td><td><input type = radio name=\"12345\" value=\"sendtome\" id=\"two\"></td><td><input type=radio name=\"12345\" value=\"spam\" id=\"three\"></td>";
print "<input type=\"hidden\" name=\"emailarrayname[12345]\" value=\"12345\"></tr>";
print "<input type=\"hidden\" name=\"data\" value=\"\"></tr>";
print "<input type=\"hidden\" name=\"dval\" value=\"\"></tr>";
print "<tr><td><input type = radio name=\"123456\" value=\"del\"></td><td><input type = radio name=\"123456\" value=\"sendtome\"></td><td><input type=radio name=\"123456\" value=\"spam\"></td>";
print "<input type=\"hidden\" name=\"emailarrayname[123456]\" value=\"123456\"></tr>";
print "<tr><td><input type = radio name=\"123457\" value=\"del\"></td><td><input type = radio name=\"123457\" value=\"sendtome\"></td><td><input type=radio name=\"123457\" value=\"spam\"></td>";
print "<input type=\"hidden\" name=\"emailarrayname[123457]\" value=\"123457\"></tr>
<tr><td><input type=\"checkbox\" name=\"delgroup\" value=\"delgroup\" onClick=populateFields(this.form)></td><td><input type=\"checkbox\" name=\"sendtomegroup\" value=\"sendtomegroup\" onClick=populateFields(this.form)></td><td><input type=\"checkbox\" name=\"spamgroup\" value=\"spamgroup\" onClick=populateFields(this.form)></td></tr><tr><td><input type=submit value=submit name=submit></td><td><input style=\"font-size: 10px;\" type=reset name=\"reset\" value=Clear></td></tr></table>";
print "</form>";
?>
</body>
</html>
I have written the javascript code populateFields, however it doesn't seem to work.
Appreciate any help in this regards.
Thanks,
Tewari