-- Guillaume ORIOL <[email protected]> wrote (on Wednesday, 10 February 2010, 12:49 PM +0100): > Searching for a solution to a dojo ComboBox issue, I've found an old > ticket > (http://n4.nabble.com/Zend-Dojo-Comboboxes-and-form-populate-td648990.html) > on this topic. > > The problem is: as the ComboBox dijit permits to enter a value that > is not in the list, once this value has been saved, how can we > display a form to edit the saved value. > > Matthew Weier O'Phinney was pointing that "setting the value to a > value not in the list simply will not work". And Cameron suggested a > workaround for it. > > Any plan to change the ComboBox behaviour?
Well, you'd have to change it in Dojo. ComboBox is like a combination <select> and text <input>. It allows you to enter text freeform, and if that text matches selections provided to it, makes it easy to choose one of those matches -- it's basically autocompletion. That said, you can also simply use it as a dropdown, or as a text input -- both are valid use cases. Additionally, the source for the select options does not have to be present at element definition; the dijit can point to a remote dojo.data store, and the select options can be retrieved dynamically, and the server can use the provided input to do selective matching when returning values. The ComboBox dijit itself only allows setting a default value that matches one of the select options; anything else will be ignored. The only way we could counter that in ZF is to take the value provided and add it to the select options. However, this is not viable in situations where a remote dojo.data store is being used to populate the options. Basically, the behaviour you want cannot be achieved with ComboBox; you'd need to write your own custom dijit and corresponding ZF form element. -- Matthew Weier O'Phinney Project Lead | [email protected] Zend Framework | http://framework.zend.com/ PGP key: http://framework.zend.com/zf-matthew-pgp-key.asc
