RE: [PEAR] Pear HTML_QuickForm_Controller
| From: | Mike Carter | Date: | Mon, 06 Oct 2003 09:47:15 +0000 |
| Subject: | RE: [PEAR] Pear HTML_QuickForm_Controller | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8289@lists.php.net to get a copy of this message | ||
> -----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
________________________________________________________________________