At 20:34 16.02.2003, Dhaval Desai said:
--------------------[snip]--------------------
>How do we do it using the first option i.e javascript to count how many
>boxes are checked...could you give some example...
--------------------[snip]--------------------
Warning - untested:
<script language="JavaScript">
function validateChecks()
{
aboxes = Array('box1','box2','box3','box4','box5');
hF = document.forms['myform'];
if (hF) {
for (i = 0, count=0; i < aboxes.length; i++) {
hBox = hF.elements[aboxes[i]];
if (hBox.checked) {
++count;
if (count >= 2)
return true;
}
}
}
return false;
}
</script>
----
<form name="myform" onSubmit="validateChecks()">
<input type="checkbox" name="box1" value="1">
<input type="checkbox" name="box2" value="1">
<input type="checkbox" name="box3" value="1">
<input type="checkbox" name="box4" value="1">
<input type="checkbox" name="box5" value="1">
<input type="submit">
</form>
----
I believe you get the idea...
--
>O Ernest E. Vogelsinger
(\) ICQ #13394035
^ http://www.vogelsinger.at/
--
PHP General Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php