The form fails in any attempt to add new record. :-( The form.accepts always fails because the method isn't able to find the values from the required fields, even they being filled out and to be in the request.vars properly.
I notice that it happens because the "ID" and "NAME" attributes created by SQLFORM had different values. For instance: <input class="string" id="product_name" name="name" type="text" value="" /> If I create a form manually with the same value for "ID" and "NAME" attributes, the validation works properly and the record is saved. Below is what I'm trying to do in a controller (leaving aside the module and the view): ************************************ def create_popup(): script_submit = SCRIPT(""" jQuery('#%(form)s').submit(function(){ ajax('%(url_ajax)s',['%(list_fields)s'],'message'); return false; }); """ % {"form":"form_test", "url_ajax":URL(r=request,f='validate_popup'), "list_fields":"','".join([field for field in db.product.fields if db.product[field].writable and db.product[field].readable and (field != "id") ])} ) form = SQLFORM(db.product, _enctype=None, _id=form_name, _action=None, _method=None) return dict(form=form,script_submit=script_submit) def validate_popup(): form = SQLFORM(db.product) if form.accepts(request.vars,formname="form_test"): return DIV("Product successfully registered!") elif form.errors: return TABLE(*[TR(k, v) for k, v in form.errors.items()]) ************************************ Thanks! --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to web2py@googlegroups.com To unsubscribe from this group, send email to web2py+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---