Re: Re: FormBuilder and QuickForm_Controller
| From: | Justin Patrin | Date: | Tue, 08 Mar 2005 18:16:03 +0000 |
| Subject: | Re: Re: FormBuilder and QuickForm_Controller | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-17927@lists.php.net to get a copy of this message | ||
On Tue, 8 Mar 2005 11:52:10 +0000, Edward Grace <ej.grace@imperial.ac.uk> wrote:
> Dear Markus,
>
> > $form =& $fb->getForm();
>
> Many thanks, I was close, but not quite there. I had left out the "&" in
> $form =& $fb->getForm(), hence it clobbered the existing form.
>
> Since what I want to do is proving so tricky, I'm beginning to think I am
> approaching the problem poorly. I want to do something which I imagine is
> quite common. If a select box in the FormBuilder form doesn't contain an
> option I want then I would like the ability to add another option and
> continue entering the record being edited. For example the following
> heirachy illustrates what I would like to do
>
> Person : links to Institution
> Institution : links to Country
> Country : links to Continent
> Continent
>
> When editing "Person" and the select box does not have the appropriate
> "Institution" entry, I would go to an intermediate form and add the
> institution. If the institution form does not have the approprate country
> selection I then go to the intermediate country form. And so on...
>
> I can see that it can be done in the preProcessForm() stage, by checking the
> relevent fields and optionally redirecting to another page which would allow
> one to add the new record. However using the QFC seemed cleaner as it looked
> like it could act as a wrapper for the forms and control the flow between
> them.
>
> I've now hit my head against the wall, mixing QFC and FormBuilder seems to be
> too hard. The fact that few people seem to be doing it indicates to me that
> there is a better way to do this.
>
> Do you have any suggestions? I'm about to evaluate the "redirect" option.
>
> > Of course I'm in no way related to this guy, no-no... (ahem).
>
> Of course. ;-)
>
Hey, great timing. I *just* released a new version of FormBuilder with
the linkNewValue option, which adds a "--New Value--" option to the
bottom of link selects and sticks a hidden form beneath the select
with the form for the linked table which is shown when you select
"--New Value--". I've currently set it up to only deal with 1 layer,
but the code should be perfectly capable of doing nested "--New
Value--" forms within the previous one. Of course, this will slow down
your page considerably depending on the # of links in the tables.
Check it out and let me know: 1) if it works for you and 2) if you
have any suggestions. As usual, docs are in the wiki and within the
source.
--
Justin Patrin