Hi *,
I got an sqlform created with SQLFORM.factory and I want to assign a validator to a field of theirs that depend to the value of another field so I have do asign validators outside the form definition such as is done in this example I found that use a table:

db.define_table('t','Field('a'),Field('b'))
db.t.a.requires=IS_NOT_EMPTY()
db.t.b.requires=IS_EXPR('value==%s' % repr(request.vars.a))

so I was expecting to do:

form = SQLFORM.factory(Field('a'),Field('b'))
form.a.requires=IS_NOT_EMPTY()
form.b.requires=IS_EXPR('value==%s' % repr(request.vars.a))

or at least:
form.vars.a.requires=IS_NOT_EMPTY()
form.vars.b.requires=IS_EXPR('value==%s' % repr(request.vars.a))

but none of them give the expected result.

Any idea??

Thenk you in advance

Cheers

    Manuele

Reply via email to