Re: [Quixote-users] Customizing form using URL parameters

Oscar Rambla <[email protected]> Sun, 14 Nov 2004 03:17:41 -0800
Newsgroups gmane.comp.web.quixote.cvs
Organization CODI
Message-ID <[email protected]>
On Saturday 13 November 2004 17:06, Shalabh Chaturvedi wrote:
>I subclassed
> and redefined is_submitted() of Form. But widgets use a mind of their
> own to determine if the form was submitted. The logic is in the parse()
> method called on a widget by Widget.render()->get_error()->parse(). So
> widgets are parsed anyway, irrespective of whether the form is submitte=
d
> or not.
>
> So while the form.is_submitted() is False, the widget thinks the form i=
s
> submitted resulting a page where the error notice 'There were errors...=
'
> is not displayed but each widget shows its error message anyway.
>
> A clean fix would change class Widget to use the form's is_submitted()
> method. It would also mean that the widgets know which form contains
> them (they currently don't). In short subclassing may not solve this
> one. Perhaps creating a mixin and injecting into Widget, in addition to
> subclassing Form, may be the only way short of core changes.
>
> Cheers,
> Shalabh
>

I think you are not forced to sublclass, although I'm not sure if it stil=
l=20
could be convenient.

I think the solution is a combination of different things that mostly hav=
e=20
been already suggested in previous posts.

-hidden inputs.
-play with the form method.
-use of form.clear_errors

HTH

-Oscar Rambla