I have a list of 42,743 zip codes associated with all 50 US states.
We ask 2 questions. Q1. what is your state Q. What is your zip code?
I need to:
1. Validate the zip code entered in Q2 by a respondent is valid (part of that list)
2. Make sure there is a match between the state Q1 and zip code entered (If you tell me you are in NY, your zip code must be from the NY list.
3. Where there is a mismatch, an alert "Please enter a valid zip code for your state" should show up. The respondent should not be able to continue until there is a match. If the mismatch persists after 2 attempts terminate.
4. Given the large number of zip codes, I need a way to do it that doesn't crash the survey.
I thought of using ranges, but there is a risk of letting invalid zip codes in. I know the valid zip codes, but not the invalid ones.
Can anybody share a code that can accomplish all this?
Zip Code validation
Resolved
1 reply