Re: HTML_QuickForm problems using $_REQUEST val for hidden element
| From: | Alexey Borzov | Date: | Wed, 26 Sep 2007 15:33:06 +0000 |
| Subject: | Re: HTML_QuickForm problems using $_REQUEST val for hidden element | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-27996@lists.php.net to get a copy of this message | ||
Hi,
Jeremiah Mattison wrote:
So I'm trying to pass the contents of an element back to the form as a hidden element to do some checking to see if the content had changed before doing validation. The problem is it just keeps passing the original value of that post var (if any) even though I can dump the var contents and see that it has changed right before the QF code. I can pass a manually coded hidden element just fine. Here is a basic example: --- print_r($_REQUEST); $form = new HTML_QuickForm('frmTest'); $form->addElement('text', 'test', 'Test:'); $form->addElement('hidden', 'lasttest', $_REQUEST['test']);When you add an element to the form, its value is set to the value stored in said form (in your case the submitted value). You should use the setValue() on element after you add it to the form. Ability to pass a value to hidden element's constructor is a mis-feature of current QuickForm as it will just be overwritten if the form was submitted. This of course doesn't change the fact that your use of the $_REQUEST variable instead of a piece of a real code led the discussion in the wrong direction. Also "If you can't help me, move along." isn't the wisest phrase you can use when writing to the package's maintaner.