Re: Pear HTML_QuickForm_Controller

From: Date: Mon, 06 Oct 2003 13:47:21 +0000
Subject: Re: Pear HTML_QuickForm_Controller
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-8295@lists.php.net to get a copy of this message
Hi Mike, Do you mean that button... $addElement('submit', $this->getButtonName('addMember'), 'Add family member'); ...will reload the page if the addMember-action is defined as (basically): $QF_Controller_form->addAction('addMember', new HTML_QuickForm_Action()); ??? Don't you actually have to add something like $page->handle('display'); to your action class if it extends class HTML_QuickForm_Action to make it reload the page? For example: class addMemberAction extends HTML_QuickForm_Action { function performe(&$page, $actionName) { // do some stuff $page->handle('display); } } Am I missing something here or did I missunderstod you? /Markus "Mike Carter" <mikeatwork@ukonline.co.uk> wrote: > > > > -----Original Message----- > > From: Daniel Kopp [mailto:pear@daniu.de] > > > > > > I would like to have a Form were I can Add some fields by clicking a > > (submit) Button. Like this: > > > > Form to Enter family data ... > > Button: "Add family member" > > > > By clicking the button the form should be echoed again - with > > entry fields for one more family member. > > > > But ... How do I get back to the same form? > > > > I had 2 ideas: > > a rule: > > > > $this->addElement('submit', 'add','Add User'); > > $this->addElement('submit', $this->getButtonName('submit'), > > 'Send'); > > $this->addRule($this->getButtonName('submit'), > > 'Bitte Send eingeben', 'required', null > > 'client'); > > > > (to be honest - I don't really know what 'add' or > > $this->getButtonName('submit') means or how it has to be but > > I tried a lot so I just post it as I think this is not the > > problem even it might be wrong > > here) > > You need to define a new Action class. The Action is "addMember". You > associate an action name with the form submit button using the > $this->getButtonName('addmember') method. > > Some standard actions are provided in pear/HTML/QuickForm/Action/ which > may be of help to get you started. Basically you new addmember class > should 'extends HTML_QuickForm_Action'. > > If your action class doesn't include anything like $page->handle('jump') > then your form should simply re-load and not move on to the next page. > See the Action/Next.php for example of how to move on to the next page. > > > > PS.: this is my first post here - hope I did not make any > > major mistakes > > I make enough :-) > > Regards, > > > - Mike > > > ________________________________________________________________________ > This email has been scanned for all viruses by the MessageLabs Email > Security System. For more information on a proactive email security > service working around the clock, around the globe, visit > http://www.messagelabs.com > ________________________________________________________________________

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