I also checked using chrome developer tools that the <div> which contains the _formkey and _formname is not getting generated (missing from HTML). May be that is the reason the form is not working.
What may be the reason for this ? and what is a feasible solution ? On Monday, April 2, 2012 10:55:51 AM UTC+5:30, Sushant Taneja wrote: > > Hi, > > I tried with form.validate() and also with form.process().accepted. Can > you provide some sample code on how do I achieve the above ? > I am already providing the name of the form while declaring it. How is it > different from web2py generated _formname ? > > On Monday, April 2, 2012 5:07:14 AM UTC+5:30, Anthony wrote: >> >> In the method which defines the registration form, I return upload_form >>> alongside as : >>> >>> return(reg_form=reg_form,upload_form=upload_form) >>> >>> The problem is that the _formkey and _formname hidden fields are created >> when you call form.accepts() -- so you have to call form.accepts() both >> when the form is first created and returned to the view and when the form >> is submitted. The form object that you are returning to the view does not >> include those hidden fields, but the form processing code in upload_image() >> is expecting those fields to be there. Also, it is recommended that you use >> the newer form.process() or form.validate() API rather than form.accepts(). >> >> Anthony >> >>

