After disabling firefox browser cookies, SQLFORM is unable to accept the form, values are not inserted in db, also it does not show any errors. It just submits the form and returns new empty form. Does SQLFORM work only when cookies are enabled?
I am able to submit the form successfully by adding argument session=None and formname=None to SQLFORM.proccess(), but it adds another issue- form double submission. when page is refreshed after submission, it resubmits the values.
How to use SQLFORM when cookies are disabled, also prevent double submission?
Code:
#models/db.py
db.define_table("person", Field("name", "string"))
# controllers/default.py
def add_person():
form = SQLFORM(db.person)
# if form.process(session=None, formname=None).accepted:
if form.process().accepted:
response.flash = "form accepted"
elif form.errors:
response.flash = "form has errors"
return dict(form=form)
<!-- views/default/add_person.html -->
{{extend "layout.html"}}
{{=form}}
Thank You
- Gaurav Vichare