durusmail: qp: Form reset?
Form reset?
2007-10-18
2007-10-29
2007-10-29
2007-10-29
2007-10-29
2007-10-30
2007-10-30
2007-10-30
2007-10-30
2007-10-30
Re: Form reset?
2007-10-30
2007-10-30
2007-10-30
2007-11-02
2007-11-19
Form reset?
Tristan Short
2007-10-29
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
>> QP@mems-exchange.org
>> http://mail.mems-exchange.org/mailman/listinfo/qp
>>
>
> _______________________________________________
> QP mailing list
> QP@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/qp
>
>

reply