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?
David K. Hess
2007-10-29
In staring at the code and mulling over various ideas I've come up
with the following pattern to try. David, would this be the recommend
way to do try and implement this behavior within 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()

If I'm understanding the usage correctly, render will not load values
from the request unless the form has been touched by is_submitted or
has_errors?

Dave

On Oct 18, 2007, at 1:41 PM, David K. Hess wrote:

>
> Is there a good/recommended way to reset a submitted form on the
> server side? I would like to process a submitted form, reset it
> back to default/empty and then render it again in one request. In
> the past I've cleared the get_request() dictionary but this page
> has more than one form on it (using the nifty "prefix" keyword on
> Form) so that's problematic.
>
> Dave
>
> ------
> David K. Hess
> Cell 214.684.5448 | Fax 214.764.7183
> dhess@fishsoftware.com
>
>
> _______________________________________________
> QP mailing list
> QP@mems-exchange.org
> http://mail.mems-exchange.org/mailman/listinfo/qp
>

reply