Re: FormBuilder -- add header options to auto-linked select menus
| From: | Justin Patrin | Date: | Wed, 18 Aug 2004 20:12:37 +0000 |
| Subject: | Re: FormBuilder -- add header options to auto-linked select menus | ||
| References: | 1 | Groups: | php.pear.general |
| Request: | Send a blank email to pear-general+get-14168@lists.php.net to get a copy of this message | ||
On Wed, 18 Aug 2004 12:58:05 -0500, Sarah Gray <sarah@fabled.net> wrote:
> Hi --
>
> I think this is simple but I'm not sure how to do it.
> When you make a linked field in a formBuilder
> form through the database.links.ini file,
>
> eg,
> [mc_SPs]
> ethnicity_id = mc_val_Ethnicities:ethnicity_id
>
> how do you add options to this field (eg a header option
> like "Select Ethnicity").
>
> I know how to add options when just using quickform --
>
> $quickForm =& new HTML_QuickForm_select($selectNameField,
> $selMenuInfo['LABEL']);
> $quickForm->addOption( $selMenuInfo['HEADER_TEXT'], '');
>
> --
>
> but not on these auto-linked fields.
>
> Can someone post an example or explanation?
>
Use something like this in your DataObject class:
function postGenerateForm(&$form) {
$sel =& $form->getElement('selectElementName');
$sel->addOption(...);
}
--
DB_DataObject_FormBuilder - The database at your fingertips
http://pear.php.net/package/DB_DataObject_FormBuilder
paperCrane --Justin Patrin--