Re: multiselect QuickForm and selected multiselect options
| From: | Justin Patrin | Date: | Tue, 28 Jun 2005 16:21:38 +0000 |
| Subject: | Re: multiselect QuickForm and selected multiselect options | ||
| References: | 1 2 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-19803@lists.php.net to get a copy of this message | ||
On 6/27/05, Dan Rossi <pear@electroteque.org> wrote:
> On 28/06/2005, at 4:23 PM, Dan Rossi wrote:
>
> > Hi there, I asked this question before and the source doesnt tell me
> > anything, how am I supposed to load the options for the second box of
> > the multiselect element ? It can only managed to get the left box
> > options ?? Let me know.
> >
>
> Hey i debugged the source, to load options into the second select its
> via setDefaults however there is one catch
>
> i load options in a 2d array like
>
> $array[userID] = username;
>
> where userID is the primary key and username is the option text.
> However to seDefaults into the second select it requires the key to be
> the value :) So $arr[] = userID;
Well of course. The selected options (setDefaults) care nothing about
the displayed value of an option. This is the same (AFAIK) as a normal
multi-select.
>
> array_push($arr,$userID);
>
> all works perfect top job ppl
>
--
Justin Patrin