Re: extending DataObjectFormBuilder will not work

From: Date: Wed, 27 Oct 2004 16:00:51 +0000
Subject: Re: extending DataObjectFormBuilder will not work
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15164@lists.php.net to get a copy of this message
On Wed, 27 Oct 2004 15:11:29 +0200, Alexander Petri <alex.petri@gmx.de> wrote: > i tested to this to genereate separate FormObjects > but nothing works... > > class userForm extends DB_DataObject_FormBuilder > { > var $createSubmit=false; > var $submitText="Hallo"; > > function userForm(){ > $this->formHeaderText("Testtetetet"); > $this->createSubmit=false; > } > > } > > ////////////////////////////////// > class adminForm extends DB_DataObject_FormBuilder > { > var $createSubmit=false; > var $submitText="Hallo"; > > function adminForm(){ > $this->formHeaderText("Testtetetet"); > $this->createSubmit=false; > } > > } > > i use this code: > .... > $builder =& userForm::create($user); > print_r($builder); > $form =& $builder->getForm(); > if($form->validate()){ > $form->process(array(&$builder,'processForm'),false); > > }else{ > $my_form = $form->toHtml(); > } > > what can i do? > Hmmmm, those docs need to be updated... First of all, you would need to be extending DB_DatObject_FormBuilder_QuickForm due to some recent changes. Second, create() won't get you your special FB as it 1) doesn't check and 2) just can't figure out what you're using before create(). You could implement your own create() function for these classes to give you the correct class. HOWEVER, if the options you're setting are specific to a certain table (hence a specific DO) then you should really be setting them in the DO: $this->fb_createSubmit = false; -- paperCrane --Justin Patrin--

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