Opened 14 years ago

Last modified 14 years ago

#82 new defect

Validation of postcodes not correct

Reported by: Dominic Hargreaves Owned by: David Sheldon
Priority: critical Milestone:
Component: Website Version:
Keywords: Cc:


5-character outwards have got into our database, this shouldn't be possible.

Change History (1)

comment:1 Changed 14 years ago by Dominic Hargreaves


As a rule, to parse a postcode into prefix and suffix, you should parse the
suffix first.  Postcodes always, without fail, end in 3 characters.  Remove
these 3 characters from the end and the remaining characters you are left 
with belong to the prefix which either contains 3 or 4 characters.  If you 
do this the other way around, checking the prefix first, it is difficult to
determine whether you are dealing with a 3 or 4 character prefix, which is
probably why these errors appeared.
Note: See TracTickets for help on using tickets.