Re: db_dataobject_formbuilder and quickform hierselect
| From: | Justin Patrin | Date: | Wed, 05 Jan 2005 01:54:36 +0000 |
| Subject: | Re: db_dataobject_formbuilder and quickform hierselect | ||
| References: | 1 2 3 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-16610@lists.php.net to get a copy of this message | ||
On Tue, 04 Jan 2005 19:31:34 +0100, Arne Gellhaus
<arne.gellhaus@gellhaus.de> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Markus Wolff wrote:
>
> | Arne Gellhaus wrote:
> |
> |> i am trying to build a form with formbuilder and i would like to
> |> replace two fields by a hierselect quickform element. Has
> |> somebody done this already, or is it even possible with
> |> formbuilder out of the box?
> |
> | this is not possible out of the box. You need to predefine this
> | element using the fb_preDefElements array, like this (in your
> | DataObject):
>
> The problem is, that the qf hierselect element is a group, so i cannot
> replace the two elements with the corresponding hierselects, but I
> have to
> 1. create a virtual field (overwrite dataobject::table())
> 2. set fb_fieldsToRender
> 3. create manually a hierselect element
> 4. write all the database code to get the data in my hierselect group
Well, this would be DO code which is a bit simpler than SQL queries and such.
> 5. overwrite dataobject::update and dataobject::insert to not add the
> virtual field but put the values from hierselect in the right fields.
You don't have to do this. You can just have the hierselect be the
first of the 2 elements and make the second one hidden (or something
like that). Then you can override preProcessForm to put the values in
the right place in the array. This is much simpler than using a
virtual field.
>
> This defeats the task of formbuilder to allow a rapid development,
> because it is easier to write the quickform and database code by hand :-).
I disagree. A hierselect is a high level element. Besides which you're
still getting lots of other automation with FormBuilder. Adding this
yourself is about the same as making your own form, only now you can
use it with any piece of formbuidler code.
>
> I think my hierselect case is a common case in database application
> and i would like to see support for it in formbuilder. Does this fit
> in your "grand scheme of things" and is it possible to implement
> without interfering with the design too much?
It could be added...if you specify the two fields to make the
hierselect from (and your links are set up right) it could do it, but
this is getting pretty complicated. And if you look at FB it's already
huge. I've been adding some fairly large chunks of code and it's
getting unweildy. This would only add to it.
However, we are looking into a possible seperation of the more
complicated elements (crosslinks, triplelinks, reverselinks) or maybe
all of them into their own objects. This would be akin to how QF
already has each element in its own class. Hmmm...I'm starting to redo
QF...oh well.
>
> Thanks,
--
Justin Patrin