Re: FormBuilder -- add header options to auto-linked select menus

From: Date: Wed, 25 Aug 2004 23:11:20 +0000
Subject: Re: FormBuilder -- add header options to auto-linked select menus
References: 1 2 3 4  Groups: php.pear.general 
Request: Send a blank email to pear-general+get-14297@lists.php.net to get a copy of this message
Justin Patrin wrote: > On Wed, 18 Aug 2004 23:44:24 +0200, Norbert Mocsnik > <pear-general@mocsnik.hu> wrote: > > Justin Patrin wrote: > > > Use something like this in your DataObject class: > > > function postGenerateForm(&$form) { > > > $sel =& $form->getElement('selectElementName'); > > > $sel->addOption(...); > > > } > > > > Afaik this will add the option to the end of the list. > > This is why I implemented fb_selectAddEmpty in > > FormBuilder (was it me?) .. that could be improved > > in a future version so it can add arbitrary text as the > > first option to the list. Thanks for writing. I re-checked my result and see that It *does* add the option to the end of the list, which I hadn't realized because even though it is the last element it still comes up as the top option in my dropdowns, which is what I was looking for. (ie, when you look at the elements in the list, "Select A Country" is listed under "Zimbabwe", but when the page loads the dropdown says, as it should, "Select A Country". I'm not sure why this is, but it is. > True. If QF doesn't support adding options to the top of the select > box, perhaps this could be added. Shouldn't be too hard. > > This is kind of like my moving elements patch that Bertrand refuses to > apply even though is *works perfectly*! It does work perfectly. I love it. It should be added ;) s. > > > -- > DB_DataObject_FormBuilder - The database at your fingertips > http://pear.php.net/package/DB_DataObject_FormBuilder > > paperCrane --Justin Patrin-- > > -- > PEAR General Mailing List (http://pear.php.net/) > To unsubscribe, visit: http://www.php.net/unsub.php

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