nodster
Junior Member
Posts: 4
Registered: 6/14/2007
Member Is Offline
|
| posted on 6/14/2007 at 08:54 AM |
|
|
UK PostCode
Hi there,
this is a fantastic script, however is there anyway that i can change the postcode format to check for a UK postcode.
It seems to only validate postcodes in the form of ZIP code ie numerical values.
In the UK the postcode works on AB12 3CD ?
TIA
edit to add i found this reg | Code: | (GIR 0AA|[A-PR-UWYZ]([0-9]{1,2}|([A-HK-Y][0-9]|[A-HK-Y][0-9]([0-9]|[ABEHMNPRV-Y]))|[0-9][A-HJKS-UW])[0-9][ABD-HJLNP-UW-Z]{2})
|
how do i incorporate it into the validation script?
|
|
|
tigra
Administrator
Posts: 1982
Registered: 6/17/2002
Location: US, CO
Member Is Offline
|
| posted on 6/14/2007 at 03:33 PM |
|
|
Assuming this regexp is correct you can put it in the validator.js among other formats and make it embedded so you can refer it by assigned name.
example from validator.js:
'alphanum': /^\w+$/,
then you use it as:
'f':'alphanum'
or you can use the regexp right in the config
'f': /^\w+$/
|
|
|