Perfect - Thanks guys.

On Thu, Dec 6, 2012 at 5:24 PM, Anthony <abasta...@gmail.com> wrote:

> Or maybe something like this:
>
> db.define_table('thing',
>     Field('a', 'boolean', default=True),
>     Field('b', requires=IS_NOT_EMPTY() if request.vars.a else None))
>
> Anthony
>
>
> On Thursday, December 6, 2012 6:00:52 PM UTC-5, Massimo Di Pierro wrote:
>>
>> 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
>>>
>>>
>>> --
>
>
>
>

-- 



Reply via email to