Opened 11 years ago

Closed 10 years ago

#5670 closed (fixed)

UKPostcodeField made more forgiving of input format

Reported by: scott@… Owned by: nobody
Component: contrib.localflavor Version: master
Severity: Keywords: uk postcode
Cc: Triage Stage: Accepted
Has patch: yes Needs documentation: no
Needs tests: no Patch needs improvement: yes
Easy pickings: UI/UX:


The UKPostcodeField in does a good job of checking a UK postcode is valid. However, it requires the letters to be uppercase and a space between the two parts. I think that's a bit too strict.

Here is a version that is more forgiving. It uppercases the string and inserts the space in the correct place before validation.

Patch and tests attached.

Attachments (2)

ukpostcodefield.diff (3.7 KB) - added by scott@… 11 years ago.
Patch and tests
ukpostcodefield2.diff (3.8 KB) - added by scott@… 10 years ago.
New patch against trunk (includes tests)

Download all attachments as: .zip

Change History (5)

Changed 11 years ago by scott@…

Attachment: ukpostcodefield.diff added

Patch and tests

comment:1 Changed 10 years ago by Simon G <dev@…>

Triage Stage: UnreviewedReady for checkin

comment:2 Changed 10 years ago by Jacob

Patch needs improvement: set
Triage Stage: Ready for checkinAccepted

This patch no longer applies cleanly. Can you update it to apply against trunk?

Changed 10 years ago by scott@…

Attachment: ukpostcodefield2.diff added

New patch against trunk (includes tests)

comment:3 Changed 10 years ago by Malcolm Tredinnick

Resolution: fixed
Status: newclosed

(In [6952]) Fixed #5670 -- Changed the validation of the UK postcode widget to allow for easier input. Normalisation still returns the same things as previously. Patch from scott@….

Note: See TracTickets for help on using tickets.
Back to Top