Welcome to WebmasterWorld Guest from

Forum Moderators: open

Message Too Old, No Replies

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.


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.");
return (false);
Have tried both && and || but simply goes the the alert and the form breaks. What am I doing wrong here?
10:42 pm on Nov 1, 2011 (gmt 0)

WebmasterWorld Senior Member 10+ 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