Can you also please add the IS_EMPTY_OR validator? On Fri, Aug 17, 2012 at 1:37 AM, Alec Taylor <alec.tayl...@gmail.com> wrote:
> Thanks :) > > > On Fri, Aug 17, 2012 at 1:15 AM, Franco <franco.alar...@gmail.com> wrote: > >> Try with this version. I need to warning you the python regex are >> different of javascript regex, so it could be problematic depending of the >> regex that you use. >> >> El miércoles, 15 de agosto de 2012 00:37:35 UTC-3, Alec Taylor escribió: >>> >>> Thanks a heap Franco :) >>> >>> The only suggestion I have is to add the `IS_MATCH` validator >>> >>> On Wed, Aug 15, 2012 at 11:12 AM, Franco <franco....@gmail.com> wrote: >>> >>>> 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_**UR** >>>> L, 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> >>>>> >>>>> -- >>>> >>>> >>>> >>>> >>> >>> -- >> >> >> >> > > --