Ups, I made a double post. Anyway if there are any interested, here is an
example of use:
def validation():
from plugin_ValidationEngine import JsSQLFORM
f = JsSQLFORM.factory(
Field('first_name', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label
= 'First Name'),
Field('last_name', requires = IS_NOT_EMPTY(), label = 'Last Name'),
Field('id', requires = IS_LENGTH(12, 12), label = 'Id'),
Field('age', requires = IS_INT_IN_RANGE(18, 65), label = 'Age'),
Field('amount', requires = IS_FLOAT_IN_RANGE(1, 9999.99), label =
'Amount')
)
if f.accepts(request, session):
response.flash = 'Ok'
else:
response.flash = 'Bad'
return dict(form = f)
def validation2():
from plugin_ValidationEngine import JsSQLFORM
f = JsSQLFORM(db.test)
if f.accepts(request, session):
response.flash = 'Ok'
else:
response.flash = 'Bad'
return dict(form = f)
Until now i implemented 7 validators
(IS_NOT_EMPTY, IS_EMAIL, IS_URL, IS_DATE, IS_LENGTH, IS_INT_IN_RANGE,
IS_FLOAT_IN_RANGE).
I hear suggestions.
El lunes, 23 de julio de 2012 17:36:39 UTC-3, Franco escribió:
>
> Greetings everyone, I want to share with you a plugin that adds client
> side validation to your forms. I hope this be helpful to you.
>
> It uses in the same way that you use SQLFORM class.
>
>
> See you soon.
>
> PS: Sorry for my bad english.
>
>
> <https://lh3.googleusercontent.com/-koqpaOGhCvM/UA21w2sGAxI/AAAAAAAAAFQ/zE2h4FPnXi4/s1600/screen.png>
>
>
--