Thank you Johann, that worked for me.

On Monday, April 7, 2014 4:52:34 PM UTC+10, Johann Spies wrote:
>
> On 7 April 2014 08:21, chris_g <chris...@gmail.com <javascript:>> wrote:
>
>
>> How do I use IS_MATCH for field validation if the field only contains 
>> data?
>>
>> This works for me:
>> IS_MATCH('^\d{10}', extract=True, error_message='Telephone number should 
>> have 10 digits.')
>>
>> so long as a 10 digit number is required.
>>
>> But what if I a want to make it acceptable to enter a 10 digit number or 
>> leave the field blank?
>>
>> Is there a way to make the IS_MATCH validator checked only if a non-empty 
>> string has been passed to the FORM for that field?
>>
>
> What about IS_EMPTY_OR(IS_MATCH('^\d{10}', extract=True, 
> error_message='Telephone number should have 10 digits.')) ?
>
> Regards
> Johann
> -- 
> Because experiencing your loyal love is better than life itself, 
> my lips will praise you.  (Psalm 63:3)
>  

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to