OK I have list/array of checkboxes created dynamically from a database (therefor all have the same name w/ different values) the checkboxes are created server-side vbscript like so:
Do Until objRS.EOF
Response.Write "<TD><input type=" & chr(34)& "checkbox" & chr(34) & "name=" & chr(34) & "selReel" & chr(34) & "value=" & objRS("ID"
& ">" & vbCrLf
objRS.movenext
arraycount = arraycount + 1
Loop
//counter sent to javascript used to step through array in Verify Data function
Response.write "<script> var arraycount = " & arraycount & "; </script>"
//onSubmit calls function VerifyData
<form action="return.asp" method="post" name="FORM1" onSubmit="return VerifyData()">
function VerifyData()
{
var form = document.FORM1;
var i, j;
//if only one checkbox was created it only checks that one to see if it was checked
if (arraycount == 1)
{
if (form.selReel.checked == true)
{
return true;
}
}
//if more than it steps through the array of all checkboxes returning true when it finds one that has been selected
if (arraycount > 1)
{
for (i = 0; i < arraycount; i++)
{
if (form.selReel.checked == true)
{
return true;
}
}
}
alert ("You must mark a box before submitting to database"
;
return false;
}
Everything works fine in IE (of course) but I am just not familiar enough with this stuff to get it to work in Netscape. Please somebody Help! TIA - Rory
Do Until objRS.EOF
Response.Write "<TD><input type=" & chr(34)& "checkbox" & chr(34) & "name=" & chr(34) & "selReel" & chr(34) & "value=" & objRS("ID"
objRS.movenext
arraycount = arraycount + 1
Loop
//counter sent to javascript used to step through array in Verify Data function
Response.write "<script> var arraycount = " & arraycount & "; </script>"
//onSubmit calls function VerifyData
<form action="return.asp" method="post" name="FORM1" onSubmit="return VerifyData()">
function VerifyData()
{
var form = document.FORM1;
var i, j;
//if only one checkbox was created it only checks that one to see if it was checked
if (arraycount == 1)
{
if (form.selReel.checked == true)
{
return true;
}
}
//if more than it steps through the array of all checkboxes returning true when it finds one that has been selected
if (arraycount > 1)
{
for (i = 0; i < arraycount; i++)
{
if (form.selReel.checked == true)
{
return true;
}
}
}
alert ("You must mark a box before submitting to database"
return false;
}
Everything works fine in IE (of course) but I am just not familiar enough with this stuff to get it to work in Netscape. Please somebody Help! TIA - Rory