durusmail: quixote-users: [PATCH] form.Form.form_submitted
Passing values to a form
[PATCH] form.Form.form_submitted
2003-09-28
2003-09-29
[PATCH] form.Form.form_submitted
Mark Bucciarelli
2003-09-28
On Sunday 28 September 2003 9:54 am, Mark Bucciarelli wrote:
> On Saturday 27 September 2003 11:22 pm, Mark Bucciarelli wrote:
> > However, I don't have any clever suggestions for how
> > to do it differently.
>
> One approach would be to change the Form.form_submitted(request) to be a
> bit smarter.  It could return true only if the form data includes info on
> all widgets (expect checkboxes, which may not be included if there is no
> value?)

This seems to work for me.

    def form_submitted(self, request):
        """form_submitted(request : HTTPRequest) -> boolean

        Return true if a form was submitted in the current request.
        """

        submitted = 0
        if len(request.form) > 0:
            submitted = 1
            for name in self.widgets:
                submitted = submitted or name in request.form

        return submitted


Regards,

Mark

reply