Form level javascript code error
Hello!
I have a not fluent in javascript but have come up with this code based on reading numerous forums. I'm not sure what the error in the code is. In this form, the zip code field is empty by default and the county field is set to "Forsyth" by default. The idea is that when the print button is hit, it makes sure that zip code entered is one of the zip codes for the default county.
Here is what I am trying to say: if COUNTY is "Forsyth" and ZIP is anything other than 27101 or 27102, alert an error.
var county = this.getField("CountyDrop").value;
var zip= this.getField("RespZip").value;
if(county == "Forsyth" && (zip != "27101" || zip != "27102"))
{// Got an error
app.alert("The zip code you entered is not part of Forsyth county");
}
I suspect the issue is on line 04 when I try to say 27001 or 27002 because the following code works fine:
if(county == "Forsyth" && zip != "27101")
In this example, I successfully get an error when the county value is Forsyth and the zip code is anything other than 27101. It's just that I need to list about 20 more zip codes.
Thank you!!
