Re: My QF is posessed

From: Date: Mon, 31 Jan 2005 08:28:59 +0000
Subject: Re: My QF is posessed
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-17285@lists.php.net to get a copy of this message
Hi, Ken Restivo wrote:
I validate form A, which has a hidden var disp_state set to "A". After validating and processing, $_REQUEST['disp_state'] === 'A'. Then I instantiate a totally new form B. I then $formB->addElement('hidden', 'disp_state', 'B'). And when QF creates this element, it *ignores* my value passed in to addElement, and instead insists on placing into it the value "A". If I print_r the element immediately after addElement'ing it, "A" is in there, not "B" which I specified. I have no code of my own in there between addElement and print_r. Who or what is making the decision to put a different variable in there? Only the shadow knows.
Well, in fact after you add the element, QuickForm checks the submitted values and assigns a submitted value to the element if found. I think that adding a possibility to set hidden field's value when adding the element was actually an oversight, since the observed behaviour is a bit unexpected. But: if you really create both forms with $trackSubmit = true, then this should not happen. If you can create a simple test case, please do open the bug.

« previous php.pear.general (#17285) next »