|
|
 tony coombe | 2012-05-11 23:01:00 |
In class.is.php
under zipcodes tthe following works for checking input of UK POST CODES:
'uk' => '^[a-z A-Z]{2}[0-9]{1,2}[a-z A-Z]{0,1}[ ]{1,2}[0-9][a-z A-Z]{2}$',
They should be in the format: CF21 2WJ or SW9N 6QQ (upper case, and with a space betwen the two blocks).
Is there a method to automatically convert the input to uppercase, or will it have to be a two stage process - input then conversion?
|
| |
2. Re: UK post codes |
|
Reply |
|
|
 Jonas Lagerwall | 2012-05-12 14:27:52 - In reply to message 1 from tony coombe |
Thanks for the regexp!
I haven't really given any thought to conversion.
jForm doesn't convert anything, not as it is now, so if the correct format is uppercase I guess the jForm way of doing it would be to remove the "a-z" from the regular expressesion and force the user to input the correct format.
Hm. Let me think on it, maybe I could add some form of conversion, it's a new idea for me. |
| |
3. Re: UK post codes |
|
Reply |
|
|
 Jonas Lagerwall | 2012-05-14 15:29:33 - In reply to message 2 from Jonas Lagerwall |
Now I've finished thinking.
At first I was against it, a validator probably shouldn't alter values, but then I thought some more and changed my mind. :)
I have implemented it in version 1.3 and uploaded it.
Thanks for the idea! |
| |
4. Re: UK post codes |
|
Reply |
|
|
 tony coombe | 2012-05-14 20:17:09 - In reply to message 3 from Jonas Lagerwall |
| Thanks very much. |
| |
5. Re: UK post codes |
|
Reply |
|
|
 Jonas Lagerwall | 2012-05-14 22:07:22 - In reply to message 4 from tony coombe |
| oops. messed it up a bit with 1.3, download 1.3.1 instead... sorry :( |
|