Welcome to WebmasterWorld Guest from 54.205.88.118

Forum Moderators: open

multiple fields- must select at least one

   
8:03 pm on Nov 1, 2011 (gmt 0)



I'm validating form data. Got everything working with one exception.

field:phone
field:mobile
field:other
field:fax

User must fill out at least one of the contact fields.

if ((theForm.phone.value== "") && (theForm.mobile.value== "") && (theForm.other.value== "") && (theForm.fax.value == ""));
{
alert("Please enter a contact number in at least one field.");
theForm.phone.focus();
return (false);
}
Have tried both && and || but simply goes the the alert and the form breaks. What am I doing wrong here?
Thanks!
10:42 pm on Nov 1, 2011 (gmt 0)

WebmasterWorld Senior Member 5+ Year Member



Try removing the ; from the end of the if statement.
2:07 pm on Nov 2, 2011 (gmt 0)



Thanks! Completely missed that one. Works now.
 

Featured Threads

Hot Threads This Week

Hot Threads This Month