Re: DOFormBuilder :: useForm problems

From: Date: Fri, 05 Nov 2004 17:21:45 +0000
Subject: Re: DOFormBuilder :: useForm problems
References: 1  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-15358@lists.php.net to get a copy of this message
On Fri, 5 Nov 2004 17:55:44 +0100, Alexander Petri <alex.petri@gmx.de> wrote: > again i tried to make different forms for one DO > and failed. > > i.e i tried to make a custom Form > but the FB renders two nearly same forms > the first one is from my CustomFormClass > and the second is rendered from the default FB > > so i tried to switch > $builder->useForm($form,true); > $builder->useForm($form,false); > > but the only thing that happens was > the switching my CustomForm over or under > the default Form > > how can i make that the default Form does not appear > and(!!!) the Form works! > > heres my code > ///////////////////////////////////////////////////////////////////////// > // Application code: > > $do = DB_DataObject::factory('news'); > $do->get($news_id); > $builder =& DB_DataObject_FormBuilder::create($do); > $form = new CustomForm(); > $builder->useForm($form); > > $form =& $builder->getForm(); > > ///////////////////////////////////////////////////////////// > // Class Code > > class CustomForm extends HTML_QuickForm { > function CustomForm($formName='CustomerForm',$method='post', > $action='',$target='_self', $attributes=null) { > parent::HTML_QuickForm($formName, $method, $action, $target, > $attributes,true); > > $this->addElement('header','ha','News ändern'); > $nr[0]="Normaler Bereich"; > $nr[1]="Privater Bereich"; > $this->addElement('hidden','id'); > $this->addElement('select', 'news_status','News > Kategorie',$nr); > $this->addElement('text', 'news_headline', 'Headline'); > $this->addElement('text', 'news_subheadline', > 'subheadline'); > $this->addElement('text', 'news_text', 'Text:'); > > //$this->addElement('text', 'nachname', 'Nachname'); > > $this->addElement('submit', 'submit', 'Speichern'); > $this->applyFilter('__ALL__', 'trim'); > > $this->addRule('news_headline','Bitte Headline > eingeben','required'); > $this->addRule('news_headline','Headline zu > kurz!','minlength',6); > $this->addRule('news_headline','Headline zu > lang!','maxlength',255); > > $this->addRule('news_subheadline','Subeadline zu > kurz!','minlength',6); > $this->addRule('news_subheadline','Subeadline zu > lang!','maxlength',255); > > $this->addRule('news_text','Bitte Text > eingeben','required'); > $this->addRule('news_text','Text zu kurz!','minlength',6); > } > } > I'm sorry, but you're not responding to my requests for information. I've responded to all of your other e-mails. Here's my question again: Why aren't you letting FormBuilder create these elements for you if they're part of the DataObject? -- paperCrane --Justin Patrin--

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