For Programmers: Free Programming Magazines  


Home > Archive > PHP Pear > April 2006 > Re: [PEAR] need to create a select element with duplicate values









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] need to create a select element with duplicate values
Justin Patrin

2006-04-10, 7:00 pm

On 4/10/06, michael geary <listmail@gearyweb.com> wrote:
> Hi Folks,
>
> this should be simple, but i cannot do it with QuickForm. I *simply*
> want to produce the following HTML:
>
> <select name=3D'element_name'>
> <option value=3D"">Select One</option>
> <option value=3D"">---------</option>
> <option value=3D"user1">George Washington</option>
> <option value=3D"user43">George Bush</option>
> .....
> </select>
>
> Notice that the first two options have a duplicate (empty) value. The
> only way i know of to create a select element with QuickForm is to
> pass an associative array to the addElement() call, but i cannot have
> duplicate keys in an assoc. array, so i cannot model this with one
> array.
>
> Smarty allows you to use two 1-dimensional arrays to achieve this
> result. What can i do for this in QuickForm?
>


Try using addOption instead (not sure if it will work).

--
Justin Patrin
Sponsored Links







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

Copyright 2008 codecomments.com