You can do:
db.define_table('thing',Field('a','boolean',default=True),Field('b',requires=IS_NOT_EMPTY()))
def check(form): if not form.vars.a and form.errors.b: del form.errors.b
form = SQLFORM(db.thing).process(on_validation = check)
On Thursday, 6 December 2012 16:42:10 UTC-6, Jim S wrote:
>
> I'm looking to write a validator that makes a field required if another
> field is set to True. I've looked at this help lesson:
>
> https://snipt.net/rochacbruno/custom-validator-for-web2py-forms/
>
> ...but don't know how I'd pass in the value of the other field from the
> form. Any clues?
>
> -Jim
>
>
>
--