How to not clear SQLFORM after it's accepted

30 views
Skip to first unread message

Horst Horst

unread,
May 25, 2018, 5:36:09 AM5/25/18
to web2py-users
I have a "contact form" page using a simple, self-submitting SQL form for filling in message, email address etc. After the form is accepted, the server tries to send an email. In case this fails, there's response.flash error message, and I'd like to just present the form again, so that users at least may get back the message they wrote.

However, since the form was accepted, all fields are cleared the next time it's shown. What's the best workaround?

黄祥

unread,
May 25, 2018, 7:11:39 AM5/25/18
to web2py-users
think you can use keepvalues = True
e.g.
if form.process(keepvalues=True).accepted:
ref:

best regards,
stifan

Horst Horst

unread,
May 25, 2018, 11:09:57 AM5/25/18
to web2py-users
Thanks, this does the job. Sorry for not RTFM.
Reply all
Reply to author
Forward
0 new messages