Checks that postcodes are in correct format. Is written for UK format, but is easily adapted for other countries.
UK Postcode Format Validation
Postcodes must conform to the following rules:-
The total length must be 6,7, or 8 characters, a gap (space character) must be included
The inward code, the part to the right of the gap, must always be 3 characters
The first character of the inward code must be numeric
The second and third characters of the inward code must be alpha
The outward code, the part to the left of the gap, can be 2,3, or 4 characters
The first character of the outward code must be alpha
Note: There are over 1.7 million UK postcodes, and that number grows daily. This page cannot guarantee that a particular code is valid, it only checks that the format is correct.
The JavaScript Source: Forms: UK Postcode Validation
Simply click inside the window below, use your cursor to highlight the script, and copy (type Control-c or Apple-c) the script into a new file in your text editor (such as Note Pad or Simple Text) and save (Control-s or Command-s). The script is yours!!!
Comments feed