QuickForm: Unable to set a default value for any elements in form element group?

From: Date: Sat, 28 Sep 2002 04:36:16 +0000
Subject: QuickForm: Unable to set a default value for any elements in form element group?
Groups: php.pear.general 
Request: Send a blank email to pear-general+get-2402@lists.php.net to get a copy of this message
Greetings. I seem to have a problem setting the default value for elements in a form element group. The examples below are for select boxes, but it seems to happen for any type of form element. QuickForm will set the default selection when the select box is created using the addElement() method, e.g., ---------------------- this code works -------------------- //set U.S. default $defaults['country_id'] = array('183'); // build list of countries $c = new Countries(); $list = $c->getCountries(); $form->setDefaults( $defaults ); $form->addElement('select', 'country_id', 'Country:', $list); $form->build(); ---------------------------------------------------------- However, when I create a select box in an array of form elements -- using the createElement() method, the set default does not seem to work, e.g., ---------------------- code not working ------------------------- $defaults['status'] = $group->status; $tselect = &HTML_QuickForm::createElement('select', 'theme_id', '', $themes ); $tentry = &HTML_QuickForm::createElement('text','theme',''); $form->addelementGroup(array($tselect, $tentry), 'Select Theme: ', '', '&nbsp;<b>OR Enter new Theme:</b> '); $form->build(); ------------------------------------------------------------------- This may be a user error in the way that I am trying to set the defaults for the array of elements or it's a bug. I appreciate any tips on possible default syntax for the array of elements. Thanks Jeff -- Enable Your Information Age (c) http://mridanga.com/

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