RE: [PEAR] QF_Controller dynamic list?
| From: | Mike Carter | Date: | Fri, 03 Oct 2003 13:28:48 +0000 |
| Subject: | RE: [PEAR] QF_Controller dynamic list? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-8261@lists.php.net to get a copy of this message | ||
> -----Original Message-----
> From: Markus [mailto:marba126@student.liu.se]
>
> Hello!
>
> I'm trying to figure out how to dynamically list elements on
> a form as the user himself adds item to from the form.
>
> I have a file-element in my form where the user should be
> able to upload a file one at a time. Each uploaded
> file(name/type/size etc) sould be added to a list in the form
> dynamically.
>
> I'm not sure how to do this yet. Is there anyone who have
> done something similar or have an idea or tip?
What are you trying to dynamically add? Is it just text to list what has
already been uploaded? Does each text item have a check box associated
with it in order to delete the item if required?
Surely it should be simply a case of keeping a counter and adding it to
the name of elements?
In a for loop....
$membership[] = &HTML_QuickForm::createElement('text', "file{$counter}",
'', array('size' => '25', 'maxlength' =>
'25'));
End loop.
Obviously you need to pick the right element type, and sort out groups
if you want to add a checkbox next to each name - to aid selection and
deleting.
- mc
________________________________________________________________________
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
________________________________________________________________________