My bad; I was using concrete (the callback for AFTER a record has been 
created) instead of onvalidation (the one for BEFORE that).

On Friday, December 2, 2016 at 11:17:57 PM UTC-5, Scott Hunter wrote:
>
> If the oncreate callback for a SQLFORM.grid sets form.errors to true, the 
> record is not created; similarly, if form.errors.<fieldname> is set to an 
> error message.
>
> However, shouldn't the form for adding the record return, and in the 
> latter case, with the specified fields showing their error messages?  In my 
> case, the list comes up instead.
>
> Here is my form & callback although there isn't much to them:
>
>     def add_handler(form):
>         if form.vars.f_Member_ID=='':
>             form.errors.f_Member_ID = "ID required"
>             session.flash = "ID required"
>             return
>     session.flash = "Handler added"
>
>     form=SQLFORM.grid( db.t_member.f_User==t.f_User, 
> args=request.args[:2], csv=False, 
>         searchable=True, deletable=False, details=False, editable=False, 
>         oncreate=add_handler,
>         fields=[db.t_member.f_Member_ID, db.t_member.f_FirstName, 
> db.t_member.f_LastName] )
>
> - Scott
>

-- 
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
--- 
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 web2py+unsubscr...@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Reply via email to