For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > March 2005 > Re: [PEAR] Quickform - multiple rows









You are viewing an archived Text-only version of the thread. To view this thread in it's original format and/or if you want to reply to this thread please [click here]

 

Author Re: [PEAR] Quickform - multiple rows
Justin Patrin

2005-03-25, 3:57 pm

On Fri, 25 Mar 2005 17:43:03 +0100, Andreas Blaafladt
<andreas@blaafladt.no> wrote:
> * Obsessed <Obsessed@dayofdefeat.be> [2005-03-25 10:52:28]:
>
> First off, I'm by no means a QuickForm expert.
>
> You're adding elements with the same names over and over again (email,
> btnEdit, btnDelete) in the same HTML_QuickForm instance, and even though
> every addElement()-operation results in a new row, it is practically
> speaking the same element. And hence, the last setDefaults() sets the
> values of the field(s).
>
> On a slightly related note, last time I did something similar in php, I
> added fields suffixed by []'s.
>
> Eg: <input type="text" name="user[]" value="Joe" />
>
> With this, I could access the the values using $_POST['user'][index],
> where index would be a number from 0 to n-1 numbers of input-fields.
>
> However, this approach doesn't seem to be possible in QuickForm.
>
> Hopefully, someone with more QuickForm-experience will say a few words
> about this. :-)
>


Of course this is possible....but you can't setDefauls correctly on
them as they all have the same name. Also, the processing may not work
right.

It's much better to use an index.

--
Justin Patrin
Sponsored Links







Also available: Server administration forum archive | Web Design forum archive | Software forum archive | Hardware reviews archive

Copyright 2008 codecomments.com