<https://lh6.googleusercontent.com/-ICahDjG44ak/UA6u1Az37FI/AAAAAAAAAFc/YVBbufNi1q8/s1600/screen.png>

Greetings everyone. I want to share with you this plugin, it's based on 
jquery-validation-engine plugin.

It's easy to use, your only need to replace SQLFORM with JsSQLFORM and 
that's it.

At this moment only supports 7 validators 
(IS_NOT_EMPTY, IS_EMAIL, IS_URL, IS_DATE, IS_LENGTH, IS_INT_IN_RANGE, 
IS_FLOAT_IN_RANGE).


Here are some examples of use:
def validation():



    from plugin_ValidationEngine import JsSQLFORM

    f = JsSQLFORM.factory(

        Field('nombre', requires = [IS_NOT_EMPTY(), IS_LENGTH(20, 3)],label 
= 'Nombre'),

        Field('apellido', requires = IS_NOT_EMPTY(), label = 'Apellido'),

        Field('cuit', requires = IS_LENGTH(12, 12), label = 'Cuit'),

        Field('edad', requires = IS_INT_IN_RANGE(18, 65), label = 'Edad'),

        Field('importe', requires = IS_FLOAT_IN_RANGE(1, 9999.99), label = 
'Importe')

    )

    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)







-- 



Attachment: web2py.plugin.ValidationEngine.w2p
Description: Binary data

Reply via email to