if form.accepts(request.vars, session,onvalidation=lambda form:\
(form.vars.init < form.vars.end) or form.errors.update({'end:'Must
be before init'}))
On Jul 20, 3:23 pm, vneve <[email protected]> wrote:
> Hello,
>
> I have a form that is something like this:
>
> form = form_factory(
> SQLField('init', 'date',),
> SQLField('end', 'date'),
> )
>
> The problem is, I don't want to insert those fields into the
> equivalent db table unless 'init' < 'end'.
> I'm aware I could do this:
>
> if form.accepts(request.vars, session):
> if form.vars.init < form.vars.end:
> ...
> else:
> response.flash = 'invalid dates'
>
> This won't insert the invalid record in my db, but it also clears up
> all input in the form, I don't want that.
> I read discussions here about form.errors, but could not figure out
> how to make it work with this case. Can anyone help me with this?
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/web2py?hl=en
-~----------~----~----~----~------~----~------~--~---