I've debated adding a "reset" method like that to Form via
subclassing. But I don't know enough about the implementation of
Widget's subclasses to be sure that "" is the correct default value
for them. I think some (all?) of them expect None as a default value.
Dave
On Oct 29, 2007, at 4:46 PM, Tristan Short wrote:
David,
Have you thought of doing it this way...
form = Form()
form.add's...
if form.is_submitted() and not form.has_errors():
doit(form.get's...)
# all form processing complete and no user resubmit required to
fix
bad entries so can safely reset form
for w in form.get_all_widgets(): #could use
form.__iter__() as well maybe?
w.value = ''
form.render()
Regards,
Tristan
David K. Hess wrote:
I would like to process a submitted form, reset it back to
default/empty and then render it again in one request. This is for a
page with multiple forms on it.
I'd like to avoid a redirect as I may set some values in other forms
or change the way the page renders based on what was in the submitted
one.
Dave
On Oct 29, 2007, at 10:45 AM, David Binger wrote:
On Oct 29, 2007, at 10:16 AM, David K. Hess wrote:
the intended usage of Form?
def get_form(self):
form = Form()
form.add's...
return form
def some_url [html] (self):
form = self.get_form()
if form.is_submitted() and not form.has_errors():
doit(form.get's...)
header()
form = self.get_form()
form.render()
footer()
I've lost track of your purpose with the second Form instance.
If you want to clear the form errors, you can just do that
explicitly.
If you want a form as if the page was not submitted
at all, maybe you should redirect("").
_______________________________________________
QP mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/qp
_______________________________________________
QP mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/qp
_______________________________________________
QP mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/qp
_______________________________________________
QP mailing list
[email protected]
http://mail.mems-exchange.org/mailman/listinfo/qp