Off course you can!
http://web2py.com/books/default/chapter/29/07/forms-and-validators#Validators
Check out the examples reported in doc for un derstanding the standard
behaviour of validators, such as:
|>>> IS_MATCH('a')('ba')
('ba', <lazyT 'invalid expression'>) # no pass
>>> IS_MATCH('a',strict=False)('ab')
('a', None) # pass!|
the second element of the output is expected to be an error message and
if it's None the test is a passed!
Cheers
Manuele
Il 10/12/14 09:33, desta ha scritto:
> Hi,
>
> web2py features some really useful validators. Is it possible to use
> them outside of forms? For example, lets assume a string that contains
> comma separated emails as inputted from the user. After splitting the
> string to extract individual emails, can I use the IS_EMAIL validator
> to validate each email?
>
> Thank you.
> --
> 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 [email protected]
> <mailto:[email protected]>.
> For more options, visit https://groups.google.com/d/optout.
--
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 [email protected].
For more options, visit https://groups.google.com/d/optout.