Re: QuickForm_advmultiselect - can you open the form with the SELECTED list already populated from a data set?
| From: | Laurent Laville | Date: | Mon, 29 Aug 2005 20:33:40 +0000 |
| Subject: | Re: QuickForm_advmultiselect - can you open the form with the SELECTED list already populated from a data set? | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-20641@lists.php.net to get a copy of this message | ||
l Burnerheimerton wrote:
I'd like to use this to change who is selected for new AND existing selections. I have two data arrays I can pass: - a list of available options (AVAILABLE) - a list of options I've already chosen (SELECTED) I'd like to know how to populate the two select fields with these two data sets. For example, imagine using this for selecting OR changing what is in your shopping cart. If I already have a cart, I want those items to populate the SELECTED list. Is this possible? If not, it would be a great(!) feature.advmultiselect is a QuickForm element and has nosense without a form but data can come from any data sources you might want. Perharps i've not understand the question, but it seems easy to set (in your case) the two select boxes with the two data sets. $AVAILABLE = [your AVAILABLE data set]; $SELECTED = [your options already choosen data set]; $form = new HTML_QuickForm(); $form->addElement('advmultiselect', 'amsList', null, $AVAILABLE); $form->setDefaults(array('amsList' => $SELECTED)); Laurent