Re: DataObjectsFormBuilder - tripleLinks
| From: | Justin Patrin | Date: | Tue, 16 Nov 2004 21:56:13 +0000 |
| Subject: | Re: DataObjectsFormBuilder - tripleLinks | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-15580@lists.php.net to get a copy of this message | ||
On Tue, 16 Nov 2004 22:14:08 +0100, Alexander Petri <alex.petri@gmx.de> wrote:
> Justin Patrin wrote:
>
>
> > On Tue, 16 Nov 2004 16:03:34 +0100, Alexander Petri <alex.petri@gmx.de> wrote:
> >
> >>i have three tables:
> >>
> >>user, hobbies, user_2_hobbies
> >>
> >>now i want to generate a form where the user can add his personal data
> >>and choose his hobbies which are given from the hobbies table
> >>this must be checkboxes - because he can select more than one hobby
> >>
> >>the user_2_hobbies table is my n:m connection which only contains the IDs
> >>of both tables...
> >>
> >>Is it possible to autogenerate a Form like this?
> >>can anyone give me a small example
> >>and give a hint how to fill my *.links.ini file?
> >>
> >
> >
> > That would be a crossLink, not a tripleLink. Have you seen the online docs?
> > ƒc3sæStkݽLå$‡
> > http://opensource.21st.de/tiki-index.php?page=Formbuilder+configuration+options#id534757
> >
> > For the links.ini file, go here:
> >
> > http://pear.php.net/manual/en/package.database.db-dataobject.intro-relations.phpM—ªŸ‘ù
> > Wë’š\êú
> >
>
> okay i tried to do this:
> (i have 2 questions to the user)
>
> $this->fb_crossLinks = array( array('table' => 'user_to_hobby_a',
> 'fromField' => 'user_id', 'toField' =>
> 'hobby_a_id'),
>
> array('table' => 'user_to_hobby_b', 'fromField'
> =>
> 'user_id', 'toField' => 'hobby_b_id')
> );
I assume you put this in the DO which you're displaying? If not, this
won't do anything. Also, you shouldn't have to give the 'toField' and
'fromField' entries. If your links are set up right, it will find
those automatically.
One last thing, if you have userEditableFields or fieldsToRender you
have to add these to them as well. Use: '__crosslink_user_to_hobby_a'
as the element name for the first one.
> // i put this in
> //function preGenerateForm(&$fb) {}
You don't need this if there's nothing in it. ;-)
>
> but the crosslink part of the form doesnt appear
>
> what else must i do, that i'm going to be happy
>
> ;-))
>
--
Justin Patrin