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

From: Date: Thu, 21 Aug 2003 11:37:01 +0000
Subject: Re: New package: DB_DataObject_FormBuilder (was: Re: [PEAR-DEV] Re: DataObjectOnSpeed Sum-Up)
References: 1  Groups: php.pear.dev 
Request: Send a blank email to pear-dev+get-20241@lists.php.net to get a copy of this message
Hi! Wow, the power of "open discussion". ;] Bertrand Mansion wrote:
Here is a suggestion, I don't know how this could be adapted to your package as it seems to extend DB_DataObject. I would like to add a Builder object to the QuickForm package. Its role would be to build the form using addElement() and addRule() calls. It will use helper objects a bit like it is done already in the Config package. So there could be a HTML_QuickForm_Builder_DataObject that would help Builder build its form based on the structure of a DataObject.
I see no actual value in the abstract Builder object, it will just have one build() method, that will accept an instance of HTML_QuickForm and return it with all the addElement()/addRule() calls done.
Furthermore, taken into consideration that DB_DataObject could be seen as a mix of a Model and a Controller, and QuickForm as a mix between a Controller and a View, I think your package belongs more to QuickForm than to DataObject.
Well, I think it does not really matter... A bridge between QuickForm (Controller) and Flexy (View) was in Flexy, now it is in QuickForm...
Of course, this will need some more work. With Alexey, we have worked a lot on QuickForm lately. We have refactored the validation process to use a new HTML_QuickForm_Validate class that will call HTML_QuickForm_Rule(s) objects, like in the Strategy pattern.
Atleast commit the stuff before marketing it! :]
We have also worked on a new HTML_QuickForm_Controller class that will handle HTML_QuickForm_Page(s) and HTML_QuickForm_Action(s) objects. This will allow for example Wizard like forms, multipage forms and probably more consistency in the processing of forms.
...when it is actually finished.
The HTML_QuickForm_Page has a method to build the form upon request, that's where HTML_QuickForm_Builder could be useful.
Yes, thus DB_DataObject_FormBuilder needs to have an additional method like _generateForm() that will accept an instance of QuickForm instead of instantiating it itself. This will be sufficient to plug it into Controller infrastructure. Or changing the API of getForm() from &getForm($action=false, $target='_self', $formName=false, $method='post') to getForm(&$form, $action=false, $target='_self', $formName=false, $method='post') and instantiating the form only when needed... Markus, can you consider this?
So before you release anything, I would like to know your opinion on this and whether you would like to help us work on a Builder infrastructure.
Do we *really* need this infrastructure?

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