Details
-
Type:
Improvement
-
Status:
Resolved
-
Priority:
Trivial
-
Resolution: Won't Fix
-
Affects Version/s: 1.10.4
-
Fix Version/s: 1.10.7
-
Component/s: Zend_Validate
-
Labels:None
Description
Zend_Validate_PostCode
Example locale en_GB
ip14 4eg
This is a valid postcode and is accepted by all tested couriers in the UK and Royal mail .. it is rejected by Zend_Validate_PostCode.
The rejections are .. lower case alpha and the space.
Users virtually never correctly enter post codes perfectly so it seems over zealous to reject them for the reasons mentioned above.
strtoupper and trim spaces would have been a reasonable validation.
I realise that the script could do this but as an improvement to the validator I thought it worth mentioning.
A strict flag could be added to return to existing functionality.
The rejection for lowercase is not really an issue, the postcode specification uses uppercase letters, and you can simply apply the StringToUpper filter to the element which is to take the postcode.
The space however is a very good point, it actually features in the documentation of the specification for UK postcodes, (http://www.cabinetoffice.gov.uk/govtalk/schemasstandards/e-gif/datastandards/address/postcode.aspx). The space in a postcode does actually have purpose, as it divides two parts of the postcode which have separate meaning (see the link).
The specification also provides a regular expression which is the accepted standard in the UK for validating a postcode is of the correct format, and this regex includes the space character (see http://www.cabinetoffice.gov.uk/media/291370/bs7666-v2-0-xsd-PostCodeType.htm).