| Alexey Borzov 2005-01-31, 8:58 am |
| 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 ele
ment 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.
|