469,277 Members | 1,897 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,277 developers. It's quick & easy.

form validation

I have a simple form validation to see if a field is left empty or not.
But what is need is to check if a zipcode is correct based on a list or array of zipcodes.

Expand|Select|Wrap|Line Numbers
  1. else if(document.adres.zipcode.value == '' || document.adres.postcode2.value == ''){
  2.         alert('Zipcode is empty!');
  3.         return false;
  4.     }
So when a user types i a zipcode thats not in a list the user gets an alert.

Martin
Feb 22 '12 #1
1 845
Dormilich
8,651 Expert Mod 8TB
the Array object has a nice and useful method named indexOf().
Feb 22 '12 #2

Post your reply

Sign in to post your reply or Sign up for a free account.

Similar topics

17 posts views Thread by Phil Powell | last post: by
16 posts views Thread by Hosh | last post: by
9 posts views Thread by julie.siebel | last post: by
7 posts views Thread by h7qvnk7q001 | last post: by
27 posts views Thread by Chris | last post: by
11 posts views Thread by Rik | last post: by
5 posts views Thread by lucyh3h | last post: by
1 post views Thread by CARIGAR | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.