Re: New package: DB_DataObject_FormBuilder (was: Re: [PEAR-DEV] Re: DataObjectOnSpeed Sum-Up)

From: Date: Thu, 28 Aug 2003 15:05:05 +0000
Subject: Re: New package: DB_DataObject_FormBuilder (was: Re: [PEAR-DEV] Re: DataObjectOnSpeed Sum-Up)
References: 1 2  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20753@lists.php.net to get a copy of this message
Alexey Borzov wrote:
What I meant is you either do $form =& new HTML_QuickForm(...lots of params...); getForm($form); or getForm($form, ...lots of params...); and in getForm(): if (null === $form) {
    $form =& new HTML_QuickForm(...lots of params...);
} Hope that's clearer now. :]
Hi Alexey, if you´d like to take a look at the latest CVS version of DB_DataObject_FormBuilder, I have added the possibility of using an existing form object there. I haven´t used the getForm method though, but you can pass the object through the options array in the factory method. I´m not yet happy with this solution though as this means that I have to pass the option array by reference - this makes things unnecessarily complicated when not using any options at all... as I now always have to make an instance like this: $options = array(); $f = DB_DataObject_FormBuilder::create($do, $options); ..even if I don´t use options (as seen above). If I want to pass a QuickForm object, it´s like this: $options = array('form' =& $form); $f = DB_DataObject_FormBuilder::create($do, $options); I prefer passing it by reference, though... I guess I´ll take it out of the options array and make a separate method setForm() or useForm() with which the object can be passed... What do you think? And is this feasible for using the FormBuilder together with the new QuickForm_Controller? CU Markus

« previous php.pear.dev (#20753) next »