PDA

View Full Version : Why Does This Not Work


Crash1hd
08-10-2002, 10:19 AM
Ok I am useing the verification script example

function CheckSubmit()
{
{
if(document.mailform.Night_Phone_Same_As_Day == "")
{
alert("Message Here")
}
}
document.mailform.submit()
}

Yet when I use it with a checkbox it doesnt work
<input type="checkbox" name="Night_Phone_Same_As_Day"> Same As Day Phone #</td>

I want to verify if the Night Phone Checkbox was clicked and if it was clicked then I can continue but if it wasnt then I need to verify night phone number which I have also (That already Works) But For some reason the checkbox doesnt work?

kansel
08-10-2002, 11:47 AM
to verify a checkbox you need to see whether it is checked

change

if(document.mailform.Night_Phone_Same_As_Day == "")

to

if(!document.mailform.Night_Phone_Same_As_Day.checked)

this is equivalent to
if(document.mailform.Night_Phone_Same_As_Day.checked == false)

then put your night phone validation code here