Re: Adding Elements dynamically in HTML_QuickForm_Controller?
| From: | Bertrand Mansion | Date: | Fri, 23 Apr 2004 21:20:55 +0000 |
| Subject: | Re: Adding Elements dynamically in HTML_QuickForm_Controller? | ||
| References: | 1 | Groups: | php.pear.dev |
| Request: | Send a blank email to pear-dev+get-28305@lists.php.net to get a copy of this message | ||
<stoffel@lucent.com> wrote :
>
> Hi,
>
> I'm trying to use HTML_QuickForm_Controller to allow end users to edit
> records in a Normalized Database. One of the fields that is in a
> record can have zero to N (where N maxes out around 50 currently I
> think) text fields. I'm using the tabbed.php example as my base to
> build on for this set of pages.
>
> I'd like to make it so that the user can just goto the tab in the form
> for that data, and start adding these field(s) as needed. The form
> would start with just one field.
>
> I assume there would need to be a button the form page to all another
> element, using the
>
> $this->addElement('text','field${n}','FieldVal${n}');
>
> But I'm not sure how to implement this. I relize I'd need to setup a
> new class, but would I have to reset the variable $this->_formBuilt
> to be false when I made the change, so as to force it to visible?
>
> For now, I can deal with just adding elements to the form, I'd just
> ignore any empty elements when I did the actually data insert into the
> DB.
>
> Can anyone point me to an example which shows me how to make this
> work?
Are you looking for something like a 'repeat' element that would display
rows using a predefined model along with 'add' and 'delete' buttons ?
Bertrand Mansion
Mamasam