accepts(...,onaccept=lambda form:do_something(form))

On Jan 14, 2:24 am, "Logan (LK)" <[email protected]> wrote:
> In the controller I have the code:
>
>     form = SQLFORM(db.plugin)
>
>     #sets a non-editable form value to an editable form value. There
> is then a DB validator which converts it into a proper slug
>     form.vars.slug = form.vars.name
>
>     if form.accepts(request.vars, session):
>
> My problem is that I want to alter data that has been submitted by the
> form before it is saved into the database. If I do what I have done
> above, then it errors out if the form hasn't been submitted.  I
> understand that form.accepts() essentially checks if the form has been
> submitted, then validates the data and then saves the data, all
> without being interrupted. Coming from Django I'm used to:
>
>     if the form has been submitted:
>         if the form is valid:
>             save the form()
>
> Which leaves many stages at which to validate data. Has anyone come
> across this problem before? What were your solutions?
>
> Thanks alot.
-- 
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.


Reply via email to