RE: [PEAR] DB_Dataobject_FormBuilder code examples

From: Date: Tue, 27 Apr 2004 08:04:12 +0000
Subject: RE: [PEAR] DB_Dataobject_FormBuilder code examples
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-12153@lists.php.net to get a copy of this message
> -----Original Message----- > From: Markus Wolff [mailto:wolff@21st.de] > Sent: 26 April 2004 19:14 > > Mike Carter wrote: > > > Hi, > > > > I realise a couple of people (at least) have been > experimenting with the > > FormBuilder class on PEAR recently. > > > > I was wondering if they had any code which demonstrates how > the subclassing > > and over riding of getForm() etc is done to add/remove form > elements to make > > the output more customised. > > Hi Mike, > > you don't use getForm() to add/remove form elements. The hook methods > are as follows: > > - preGenerateForm: > Here you can define some special fields prior to form > building. These > fields are used as you define them here, nothing else is > added to them > by FormBuilder. > - getForm: > This is a substitute for the whole form building process - > if you use > getForm(), you make the whole form right here. FormBuilder won't do > anything (except, perhaps, manage data storage later), and > the pre-/ > postGenerateForm methods become obsolete. > - postGenerateForm: > This one's triggered after FormBuilder auto-created a form based on > your DataObject. As the form object is passed by reference, you can > now modify it freely (as in adding/removing elements, setting rules > etc.) Thanks for your reply. I was working off the comments in the FormBuilder class. The 'hook' methods that you mention above, how are they supposed to be accessed - I don't understand from what is written down - how everything fits together when auto generating a form from a DataObject? Standard forms work fine, and I can set the form header, but I don't understand where I should be creating the above mentioned methods.. Hence why I'd love to see a real world example if anybody has one knocking around? Thanks, Mike C. ______________________________________________________________________ This email has been scanned by the MessageLabs Email Security System. For more information please visit http://www.messagelabs.com/email ______________________________________________________________________

« previous php.pear.general (#12153) next »