tuanyong
09-11-2003, 10:53 PM
hi all ,
i had searched the forum for past threads and did according to how to validate the radio buttons but after i have tried it in my script it can't work ..
<script type="text/javascript">
function validateForm ()
else if(document.booking.brand[0].checked || document.booking.brand[1].checked || document.booking.brand[2].checked || document.booking.brand[3].checked || document.booking.brand[4].checked)
{
alert("Please choose the brand intended for usage!");
document.booking.brand[0].focus();
return false;
}
else{
return true;
}
</script>
<form name="booking" method="POST" action="booking.asp "onSubmit="return validateForm();">
<td width="82%"><p><input type="radio" value="Avaya" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Avaya </font></b>
<input type="radio" value="Cisco" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Cisco</font></b>
<input type="radio" value="Nortel" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Nortel</font></b>
<input type="radio" value="Ericsson" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Ericsson</font></b>
<input type="radio" value="Application" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Application </font></b></p>
</td>
after i clicked submit with no radio button checked, nothing happens and it just go through to the next page ..
can someone help !!
i had searched the forum for past threads and did according to how to validate the radio buttons but after i have tried it in my script it can't work ..
<script type="text/javascript">
function validateForm ()
else if(document.booking.brand[0].checked || document.booking.brand[1].checked || document.booking.brand[2].checked || document.booking.brand[3].checked || document.booking.brand[4].checked)
{
alert("Please choose the brand intended for usage!");
document.booking.brand[0].focus();
return false;
}
else{
return true;
}
</script>
<form name="booking" method="POST" action="booking.asp "onSubmit="return validateForm();">
<td width="82%"><p><input type="radio" value="Avaya" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Avaya </font></b>
<input type="radio" value="Cisco" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Cisco</font></b>
<input type="radio" value="Nortel" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Nortel</font></b>
<input type="radio" value="Ericsson" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Ericsson</font></b>
<input type="radio" value="Application" name="brand"> <b><font face="Abadi MT Condensed Light" size="4" color="black">Application </font></b></p>
</td>
after i clicked submit with no radio button checked, nothing happens and it just go through to the next page ..
can someone help !!