Re: Validate UK postcode without a space in it
Thanks for the custom rule, I've used it and it seems to work well. Thanks again. c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate UK postcode without a space in it
What I meant was that perhaps an enhancement ticket should be opened to have the core changed. On Mon, Aug 31, 2009 at 4:54 PM, Aivaras wrote: > Or just create a custom validation rule, where you can add your own regexp - > remember, that not changing the core will always be so helpful sooner or > later ;) > > Faifas > http://www.voveris.eu/ > > > On Mon, Aug 31, 2009 at 18:58, brian wrote: >> >> It looks like the Validation regex needs to be updated. This: >> >> $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? >> [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'; >> >> should be: >> >> $_this->regex = >> '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?[\s]?[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'; >> >> Ditto for the Canadian one. >> >> On Mon, Aug 31, 2009 at 6:45 AM, >> channel5 wrote: >> > >> > Hi >> > >> > I've got a model that uses >> > >> > 'rule'=>array('postal',null,'uk') >> > >> > to successfully validate UK postcodes. >> > >> > However testing has shown that many people enter their postcodes in >> > forms without using the space, so: >> > >> > W1W 5QU <-- validates >> > W1W5QU <-- does not validate >> > >> > Has anyone got any tips on getting the validation to work irrespective >> > of whether a user includes or excludes the space? >> > >> > Thanks >> > c5 >> > > >> > >> >> > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate UK postcode without a space in it
Or just create a custom validation rule, where you can add your own regexp - remember, that not changing the core will always be so helpful sooner or later ;) Faifas http://www.voveris.eu/ On Mon, Aug 31, 2009 at 18:58, brian wrote: > > It looks like the Validation regex needs to be updated. This: > > $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? > [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'; > > should be: > > $_this->regex = > '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?[\s]?[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'; > > Ditto for the Canadian one. > > On Mon, Aug 31, 2009 at 6:45 AM, > channel5 wrote: > > > > Hi > > > > I've got a model that uses > > > > 'rule'=>array('postal',null,'uk') > > > > to successfully validate UK postcodes. > > > > However testing has shown that many people enter their postcodes in > > forms without using the space, so: > > > > W1W 5QU <-- validates > > W1W5QU <-- does not validate > > > > Has anyone got any tips on getting the validation to work irrespective > > of whether a user includes or excludes the space? > > > > Thanks > > c5 > > > > > > > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Re: Validate UK postcode without a space in it
It looks like the Validation regex needs to be updated. This: $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]? [0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'; should be: $_this->regex = '/\\A\\b[A-Z]{1,2}[0-9][A-Z0-9]?[\s]?[0-9][ABD-HJLNP-UW-Z]{2}\\b\\z/i'; Ditto for the Canadian one. On Mon, Aug 31, 2009 at 6:45 AM, channel5 wrote: > > Hi > > I've got a model that uses > > 'rule'=>array('postal',null,'uk') > > to successfully validate UK postcodes. > > However testing has shown that many people enter their postcodes in > forms without using the space, so: > > W1W 5QU <-- validates > W1W5QU <-- does not validate > > Has anyone got any tips on getting the validation to work irrespective > of whether a user includes or excludes the space? > > Thanks > c5 > > > --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---
Validate UK postcode without a space in it
Hi I've got a model that uses 'rule'=>array('postal',null,'uk') to successfully validate UK postcodes. However testing has shown that many people enter their postcodes in forms without using the space, so: W1W 5QU <-- validates W1W5QU <-- does not validate Has anyone got any tips on getting the validation to work irrespective of whether a user includes or excludes the space? Thanks c5 --~--~-~--~~~---~--~~ You received this message because you are subscribed to the Google Groups "CakePHP" group. To post to this group, send email to cake-php@googlegroups.com To unsubscribe from this group, send email to cake-php+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/cake-php?hl=en -~--~~~~--~~--~--~---