Re: FormBuilder custom select

From: Date: Mon, 19 Sep 2005 08:20:01 +0000
Subject: Re: FormBuilder custom select
References: 1 2 3  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-21042@lists.php.net to get a copy of this message
Alessandro Pasotti schrieb:
- add some code in DO preGenerateForm(): $_el = &HTML_QuickForm::createElement('sigselect', $k, $k, $options, array('onclick'=>'"window.open(\'' . $_href .'\')"')); $this->fb_preDefElements[$k] = &$_el ; Now the problem: how to populate the options in the select? Normally FormBuilder does it automatically for you taking care of links, but that don't seem to work with preDefElements. Is there a way to use FormBuilder routines also with preDefElements?
Hi Alessandro, there is, at least when it comes to get the entries for a selectbox. From the inline docs: <cite> DB_DataObject_FormBuilder::getSelectOptions() Returns an array of options for use with the HTML_QuickForm "select" element. It will try to fetch all related objects (if any) for the given field name and build the array. For the display name of the option, it will try to use the settings in the database.formBuilder.ini file. If those are not found, the linked object's property "fb_linkDisplayFields". If that one is not present, it will try to use the global configuration setting "linkDisplayFields". Can also be called with a second parameter containing the name of the display field - this will override all other settings. Same goes for "linkOrderFields", which determines the field name used for sorting the option elements. If neither a config setting nor a class property of that name is set, the display field name will be used. </cite> CU Markus

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