Re: Re: QuickForm_advmultiselect - can you open the form with the SELECTED list already populated from a data set?

From: Date: Mon, 29 Aug 2005 21:20:44 +0000
Subject: Re: Re: QuickForm_advmultiselect - can you open the form with the SELECTED list already populated from a data set?
References: 1 2  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-20643@lists.php.net to get a copy of this message
l Burnerheimerton wrote:
thanks. based on this, I tried the code below. A blank entry displays in the selected option list - you can select it but it has no label/name to it.
Is it a question about a problem you have ? please clarify
print_r() verifies there is an array of values getting to both. that won't check in the good array
$form = new HTML_QuickForm('amsCustom1');
$form->removeAttribute('name');        // XHTML
compliance //get list of services $all_people = $db->getAssoc("SELECT ..."); $selected_people = $db->getAssoc("SELECT ..."); look here
print_r($all_students); print_r($selected_students); and here
$form->setDefaults(array( //set form field defaults 'people' => array('people' => $selected_people) ) );
but i think you have a problem here with the setDefaults method you should write $form->setDefaults(array( //set form field defaults 'people' => $selected_people) ); Laurent

« previous php.pear.general (#20643) next »