Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-27 Thread Adnan Smajlovic
replaced mine with this one now :) thanks small typos: from gluon.validators import Validator def __init__(self,error_message='invalid!'): On Wed, Sep 26, 2012 at 3:25 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Yes. you can do: import re from gluon.validator import

Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-26 Thread Le Don X
don't be sorry for jumping in it is appreciated ! .. and refreshing to noticed that there are canadian folks like me on here ! to resume ... from all the responses received - the best canadian postal code validation is actually the one submitted by Adnan : this one :

Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-26 Thread Richard Vézina
You can may use .capitalize() before the vars get validated by validators. I thought that there was a way to do action before the form get validated, but I can't find in the book, something like beforevalidation, instead of onvalidation that is provided. I think that if beforevalidation doesn't

Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-26 Thread Massimo Di Pierro
Yes. you can do: import re from gluon.validator import Validator class CANADIAN_ZIP(Validator): regex = re.compile('^[ABCEGHJKLMNPRSTVXY]{1}\d{1}[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$') def __init__(self,error_message='invalid!): self.error_message = error_message def

Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-26 Thread Richard Vézina
:) Richard On Wed, Sep 26, 2012 at 3:25 PM, Massimo Di Pierro massimo.dipie...@gmail.com wrote: Yes. you can do: import re from gluon.validator import Validator class CANADIAN_ZIP(Validator): regex = re.compile('^[ABCEGHJKLMNPRSTVXY]{1}\d{1}**[A-Z]{1} *\d{1}[A-Z]{1}\d{1}$')

Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-25 Thread Le Don X
thank you guys ... so the set of characters only ( exclusively ) need to be referred to as : [A-Za-z] perfect ... thank you again. --

Re: [web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-25 Thread ian douglas
On 09/25/2012 04:08 PM, Le Don X wrote: thank you guys ... so the set of characters only ( exclusively ) need to be referred to as : [A-Za-z] Sorry for jumping in, I'm just seeing this thread for the first time. Keep in mind the following other rules, just in case you're trying to validate

[web2py] Re: Problems with a validation procedure ? - a Canadian postal code !

2012-09-24 Thread Massimo Di Pierro
requires = IS_MATCH('^[A-Z]\d[A-Z][\- ]?\d[A-Z]\d$',error_message='not a zip code') On Monday, 24 September 2012 20:13:03 UTC-5, Don_X wrote: Hello web2py users : Validating if numbers or decimals are entered on a form seem to be very straight forward and easy enough ! whether it is a