Summary | preserveVarByPost, hidden value: output not within form tags |
Queue | Horde Framework Packages |
Queue Version | HEAD |
Type | Enhancement |
State | Resolved |
Priority | 1. Low |
Owners | |
Requester | thomas (at) gelf (dot) net |
Created | 06/26/2006 (6975 days ago) |
Due | |
Updated | 11/19/2006 (6829 days ago) |
Assigned | |
Resolved | 11/19/2006 (6829 days ago) |
Milestone | |
Patch | No |
State ⇒ Resolved
State ⇒ Rejected
State ⇒ Accepted
be refactored. I'm adding it to the list of things that should be
taken care of with the incubator Horde_Form rewrite.
tell me that I'm talking bullshit and close it :-)
Cheers,
Thomas Gelf
- I wrote some kind of very tricky wizard with lots of subforms and more than
one different ways of passing through the form
- time ago I did such things like in whups/ticket/create.php - but such a form
isn't fun that way
- I wrote a "XyWizardStep extends Horde_Form" class
- and many "XyWizardStep_ChooseWhateverStep extends XyWizardStep"
classes
- I didn't call _preserveVarByPost() directly but have been calling preserve()
- there is finally one "XyWizard extends Horde_Form" class handling all
the "business logic", finding out what path to take through the forms,
running validations, navigating fore- and backward through the single
steps and finally storing the whole big thing
My problem: simply calling $form->preserve($vars) is useless - in my case
it puts the hidden fields required for preserving vars in front of the whole
html code because of the line in _preserveVarByPost() - mentioned
before.
I helped myself by "overwriting" addVariable() in my XyWizardStep class.
My addVariable() function adds a pointer to every added var to an array
named "_preserve_vars" - and a "getVarsToPreserve()" function gives me
the possibility to walk through all vars in all Inactive single forms,
allowing
me to add each of them as a hidden var to the last (currently active) form
step.
I consider this a bug - preserve() is a public function - and it shouldn't be
up to the user / coder to find out that the function behaves only correct
if you manually open and close form tags before / after calling preserve().
IMO preserve() should add all vars that should be preserved to an array,
the rendering process should then take care of writing out the hidden
input fields.
Cheers,
Thomas Gelf
Type ⇒ Enhancement
State ⇒ Feedback
Priority ⇒ 1. Low
seriously calling a private method randomly from your own code, are you?
Priority ⇒ 1. Low
Type ⇒ Bug
Summary ⇒ preserveVarByPost, hidden value: output not within form tags
Queue ⇒ Horde Framework Packages
State ⇒ Unconfirmed
printf('<input type="hidden" name="%s" value="%s" />' . "\n",
$varname,
$value);
Is there some good reason for doing so? This works when you're rendering
your form step by step (like whups/ticket/create.php) but otherwise makes no
sense and is kinda confusing...
Regards,
Thomas Gelf