IronMonkey
05-27-2003, 06:52 PM
Hi,
I'm trying to figure out how to validate a form with the following method:
If (field1 equals "this") AND (field2 equals "that")
alert("That combination is not allowed.")
So far, this is what I've come up with:
if (document.form.field1.value == "something" || document.form.field2.value == "another_something")
{ alert("That combination is not allowed...")
return false; }
However, the alert comes up even if just one of the fields equals the stated value! So, I guess that the || is basically an OR statement. What about the AND statement?
Anyone have any ideas?
Thanks.
I'm trying to figure out how to validate a form with the following method:
If (field1 equals "this") AND (field2 equals "that")
alert("That combination is not allowed.")
So far, this is what I've come up with:
if (document.form.field1.value == "something" || document.form.field2.value == "another_something")
{ alert("That combination is not allowed...")
return false; }
However, the alert comes up even if just one of the fields equals the stated value! So, I guess that the || is basically an OR statement. What about the AND statement?
Anyone have any ideas?
Thanks.