Field('date_to', 'date', requires=IS_DATE_IN_RANGE(...) if not request.
vars.until_now else None)

The IS_DATE_IN_RANGE validator can be set up so it requires the date to be 
later than request.vars.date_from. You can also use an onvalidation 
function with the form.

Anthony

On Monday, June 24, 2013 6:12:01 PM UTC-4, lesssugar wrote:
>
> On of the crud forms I generate in my app has such 3 fields:
>
> date_from (date)
> until_now (boolean)
> date_to (date)
>
> The idea is simple:
> if "until now" is checked, "date to" *can be empty*;
> else "date_to" *is required*;
>
> (I worked from ... until now */or/* I worked from ... to ...)
> *
> *
> Is there a way to implement such dependent fields e.g. when defining the 
> table? Or do I need a custom validator?
>

-- 

--- 
You received this message because you are subscribed to the Google Groups 
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to