Package home | Report new bug | New search | Development Roadmap Status: Open | Feedback | All | Closed Since Version 3.2.16

Bug #185 Problems with validate() with multiple forms or preexisting _get/_post vars
Submitted: 2003-11-02 11:22 UTC
From: fferreres at ojf dot com Assigned: avb
Status: Closed Package: HTML_QuickForm
PHP Version: 4.3.3 OS: All
Roadmaps: (Not assigned)    
Subscription  


 [2003-11-02 11:22 UTC] 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.

Comments

 [2003-11-02 16:45 UTC] User who submitted this comment has not confirmed identity
If you submitted this note, check your email.If you do not have a message, click here to re-send
MANUAL CONFIRMATION IS NOT POSSIBLE.  Write a message to pear-dev@lists.php.net
to request the confirmation link.  All bugs/comments/patches associated with this

email address will be deleted within 48 hours if the account request is not confirmed!
 [2003-12-18 08:49 UTC] tobias dot nix at web dot de
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.