Re: Question Regarding HTML_QuickForm and Add Group
| From: | Bertrand Mansion | Date: | Wed, 31 Dec 2003 09:22:03 +0000 |
| Subject: | Re: Question Regarding HTML_QuickForm and Add Group | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-9887@lists.php.net to get a copy of this message | ||
<sanjay92@hotmail.com> wrote :
> I want to display fields on same line, I have read that we can do with
> group but why all group examples uses &HTML_QuickForm::createElement. Is it
> not possible to just use with add element
>
> $form = new HTML_QuickForm('frmTest', 'post');
> $form->addElement('header', 'MyHeader', 'Employee');
> $form->addElement('text', 'Empno', 'Emp Id:');
> $form->addElement('text', 'Ename', 'Name:');
>
> How to use addGroup for addElement ?
> $form->addGroup(?????)
>
> I have seen examples like this which uses createElement:
> $name['last'] = &HTML_QuickForm::createElement('text',
> 'last');
> $name['last']->setSize(30);
> $name['first'] = &HTML_QuickForm::createElement('text',
> 'first');
> $name['first']->setSize(20);
> $form->addGroup($name, 'name', 'Name (last, first):',
> ', ');
If you want to add a group to your form, the elements composing your group
have to be added to your group, not to the form. That's why you use
createElement() statically, to create the elements, then addGroup().
Bertrand Mansion
Mamasam