-- GeorgeTrigonakis <a_guy_in_r...@msn.com> wrote (on Thursday, 19 March 2009, 02:38 AM -0700): > Hi... I am having a problem with Dojo combobox and i was hoping that you > could help me... > > the forms setup is like this: > > $video = new Zend_Dojo_Form_Element_ComboBox('video_ID'); > $video->addMultiOption('test', '1') > ->setAutocomplete(true) > ->setLabel('Video'); > > and I was expecting when i was selecting option 1 to have the value "test" > posted. > instead i get posted the value 1. > any clues why is that happening?
Yep -- it's how ComboBoxes behave. Please read the section on ComboBox and FilteringSelect in the manual, which clearly states the differences between the two. ComboBox submits the displayed value; FilteringSelect submits the option value. The reason is because ComboBox allows you to submit arbitrary values in addition to those it contains. > Jeroen Keppens wrote: > > > > Ok, just found this after re-reading the docs: > > > > "ComboBoxes return the label values > > ComboBoxes return the label values, and not the option values, which can > > lead to a disconnect in expectations. For this reason, ComboBoxes do not > > auto-register an InArray validator (though FilteringSelects do)." > > > > Please disregard my previous mail ;) > > > > Jeroen > > > > > > Jeroen Keppens wrote: > >> > >> Hi, > >> > >> I have a form with a combobox, I've set it up like this (class extends > >> Zend_Dojo_Form) : > >> > >> $country = $this->createElement('ComboBox', 'country') > >> ->setLabel('lbl_country') > >> ->setAutoComplete(true) > >> ->setMultiOptions($this->getCountryList())) > >> ->setRequired(true); > >> > >> The country list gives an associative array that looks like: > >> > >> array( > >> "af"=>"Afghanistan", > >> "al"=>"Albania", > >> "dz"=>"Algeria", > >> ... > >> ); > >> > >> The combobox is shown correctly, autocompletion works, etc... In the > >> html source I see: > >> > >> <select name="country" id="country"> > >> <option value="af" label="Afghanistan">Afghanistan</option> > >> <option value="al" label="Albania">Albania</option> > >> <option value="dz" label="Algeria">Algeria</option> > >> ... > >> </select> > >> > >> When I submit the form, I don't get the short value in $_POST, but the > >> long value: > >> > >> $_POST = array('country'=>'Albania'); > >> > >> How can I get the short value "al" in the POST array instead of the long > >> value? > >> > >> Tnx > >> Jeroen > >> > >> > > > > > > -- > View this message in context: > http://www.nabble.com/Dojo-%3A-ComboBox-%3A-POST-value-tp21531598p22596544.html > Sent from the Zend Framework mailing list archive at Nabble.com. > -- Matthew Weier O'Phinney Software Architect | matt...@zend.com Zend Framework | http://framework.zend.com/