checkbox validation
719-572-9400
719-638-3545
hi,
I have a group of checkboxes like this
Code:
<input type="checkbox" name="chk12" id="chk12" value="Yes">Quote 12
<input type="checkbox" name="chk11" id="chk11" value="Yes">Quote 11
<input type="checkbox" name="chk10" id="chk10" value="Yes">Quote 10
<input type="checkbox" name="chk9" id="chk9" value="Yes">Quote 9
<input type="checkbox" name="chk8" id="chk8" value="Yes">Other
<input type="textbox" name="chk8othertext" id="chk8othertext" value="">
If the user doesnt select one of them then i want to fire an alert
if the user selects Other checkbox and doesnt enter a value in the other textbox then fire an alert
here is my code
Code:
if (document.frm1.chk12.checked == false && document.frm1.chk11.checked == false && document.frm1.chk10.checked == false && document.frm1.chk9.checked == false && document.frm1.chk8.checked == false )
{
alert ('You didn\'t choose any of the checkboxes!');
return false;
}
else
{
return true;
}
If(document.frm1.chk8.checked ==true)
{
if(document.frm1.chk8othertext.value =="")
{
alert("enter a value");
}
}
but the code is not working
any idea
todd
todd2006, June 18th, 2008 04:14 PM
Bookmarks