Re: FB + QFC + back + linkNewValue = trouble
| From: | Justin Patrin | Date: | Thu, 26 May 2005 04:18:00 +0000 |
| Subject: | Re: FB + QFC + back + linkNewValue = trouble | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19373@lists.php.net to get a copy of this message | ||
On 5/25/05, Ken Restivo <ken@restivo.org> wrote:
> Looks like FB's linkNewValue (and the subform class too, and my own homegrown stuff, which
> all take similar approaches) creates subordinate forms. Nice idea, works great.
>
> Until you try to use it with QFC. $controller->exportValues() iterates through and calls
> exportValues() on each page of the wizard, to save its values into $_SESSION. Nice idea there too,
> works great.
>
> But when you combine the two? Trouble.
>
> QFC doesn't know about subordinate forms that were created by FB (or the subform class, or
> my own stuff). So the $page->exportValues() doesn't return it, and thus, neither does the
> QFC save it. When you click back, then next, all of your values entered into subforms are gone
> forever. I've found that this tends to alarm and frustrate users.
>
> Any ideas? I might try overriding the HTML_QuickForm_Page::exportValues() to iterate through
> the cached reference to the subforms, and return the merge of their results with the
> parent::exportValues().
>
Hmmm, I hadn't tried using linkNewValue or SubForms with QFC. However....
SubForms, assuming you're using
http://pear.reversefold.com/SubForm.phps,
*should* work fine. I did
everything I could to make sure that this was a real element. Its
values are exported just like normal elements' values. setDefaults
(which I assume QFC uses to set the values when you come back to a
form) should also work fine with subforms. I'll do a quick test myself
to make sure of this, though.
Well, what do you know, it doesn't work. And after a bunch of fiddling
I finally figured out that QFC is setting _submitValues manually.
This, of course, wasn't being copied to the subform so the values
weren't set. I've fixed my SubForm code.
However, IMHO QFC really shouldn't be doing it that way as it breaks
all of these kind of things. IMHO it should use setDefaults or
setConstants as that would accomplish the same thing.
linkNewValue is, indeed, a problem, as I just made it work without
trying to make it a normal QF element. The linkNewValue element
(PopupSelect) does not behave like a normal QF element. It's very
tightly coupled to FB and this is why it's not working in QFC. You may
be able to hack it to make it work, but a much better solution would
be to port FB's linkNewValue to use the SubForm element.
I'll put this on my list of FB things to do.
--
Justin Patrin