Re: Bug #185 [Com]: Problems with validate() with multiple forms or preexisting _get/_post vars
| From: | Federico Ferreres | Date: | Sun, 21 Dec 2003 00:20:46 +0000 |
| Subject: | Re: Bug #185 [Com]: Problems with validate() with multiple forms or preexisting _get/_post vars | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-24588@lists.php.net to get a copy of this message | ||
I think you need to pass a true to the object creation (quickform). It
was the last argument of the constructor last time i checked. Tale a
look at quickform.php
Federico
On Thu, 2003-12-18 at 05:49, PHP Bug Database wrote:
> ATTENTION! Do NOT reply to this email!
> To reply, use the web interface found at
> http://pear.php.net/bugs/bug.php?id=185&edit=2
>
>
> ID: 185
> Comment by: tobias dot nix at web dot de
> Reported By: fferreres at ojf dot com
> Status: Closed
> Bug Type: HTML_QuickForm
> Operating System: All
> PHP Version: 4.3.3
> New Comment:
>
> Hello,
>
> looks like this is fixed.
> How can I enable the feature from HTML_Quickform Bug #185?
>
> http://pear.php.net/bugs/bug.php?id=185
>
>
> http://pear.php.net/package-changelog.php?package=HTML_QuickForm
> - Added possibility to check whether form was actually submitted (see
> also bug #185).
>
> Thanks, Tobias.
>
>
> Previous Comments:
> ------------------------------------------------------------------------
>
> [2003-11-02 11:45:09] avb@php.net
>
> This will be addressed in upcoming 3.2 release.
>
> You'll be able to pass a parameter to constructor that will make
> QuickForm add a special hidden element to the form and check its
> existence in submitted values. The form will be treated as submitted
> only if this element is present.
>
> Besides, if you want to submit a bug for QF_Controller, please do so in
> its own category not within a bigger report for QF.
>
> ------------------------------------------------------------------------
>
> [2003-11-02 06:22:35] fferreres at ojf dot com
>
> Description:
> ------------
> This is probably not a bug, but a real nuissance, so my apologies if
> this does not belong here...
>
> Creating two or more forms with QuickForm works perfectly. However, if
> one uses ->validate() as a test for process()ing, then when any one
> form is submited, all forms are validate()ed and processed. Haven't
> found any other way to determine if a form is submited expect creating
> hidden fields and cheching them along with validate() for each form.
>
> Also, if two forms share elements with identical names, worng data
> would be fed to the other forms.
>
> Reproduce code:
> ---------------
> Create two or more forms forms and display them on one page. Submit any
> of the forms. All forms are validated (and processed or errors shown
> for all forms depending on rules).
>
> Expected result:
> ----------------
> Only the actual submited form is treated as actually having been
> submited.
>
> Actual result:
> --------------
> All forms are validate()d and thus resulting in errors on non submited
> forms are displayed. (lots of hidden variables are needed on each page
> to get around this behaveour of validate()).
>
> Side Comments:
> 1) It could probe usefull if QuickForms grouped each form's variables
> into an array like $POST_[formname][elementx]([...]). One should always
> use the interface to Quickforms and never mess the global _POST (_GET)
> arrays, so this change should not break any prior apps.
>
> 2) Page_Controller would be more usefull if pages wouldn't need to
> extend the Controller page class, as it makes it very hard to building
> dinamic multipage forms.
>
> 3) Another problem I see is that if you use a post or variable to
> determine which form to load (or to select a specific row for editing)
> then Quickforms treats it as form submited, resulting in errors shown
> to the user. Thus, one is forced to either map & unset the _post/_get
> array before calling validate after checking a hidden var (or session
> var), or doing without validate all together.
>
>
> ------------------------------------------------------------------------
>
>