durusmail: quixote-users: form2: troubles from a get
form2: troubles from a get
2004-02-24
2004-03-10
2004-03-10
2004-03-10
2004-03-10
form2: troubles from a get
Jason E. Sibre
2004-03-10
Daniel Chudnov said:
>
> Instead of just calling the canonical "if not form.is_submitted():
> return render()", there are instead two possible calls to render():
>
>      if not form.is_submitted():
>          return render()
>
>      if form.get_submit() != str('spam'):
>          return render()
>
> ...so GET calls with the params listed above still drop back to render()
> when is_submitted==True.

Widgets currently determine if they should parse themselves or not by
inspecting request.form.  In your example (providing querystring parameters)
the widgets would parse themselves.  In your case, that may be ok, and
perhaps even ideal.  Where it causes problems is when other widgets on the
form have (for example) required=True, but no value was passed in the
querystring that corresponds to that widget.  In that case, an error is
displayed to the user ('so and so is a required field', or something like
that), when the user didn't really do anything wrong.

In the current design, even if you subclass form2.Form, you can't alter that
behavior, because they currently don't look at form.is_submitted().  As Neil
implied, something has to be done about how the Widgets determine whether or
not to parse themselves.

I really like the direction form2 has gone.  I think my forms are easier to
understand and write correctly then they were with the original form
framework.  form2 just has a few nits that need picking, before it will be
as flexible as form is.


Jason



reply