I've found how to create a Zend_Dojo_Form_Element_Com
boBox to read from a data store and display the results in a autocomplete manner.
I was just wondering if anyone could tell me how to access the associated id of the data displayed in the ComboBox so that I can save the id to the database, as currently the text e.g. Dublin is being saved, not its ID of 10.
Currently my ComboBox code is as follows.
// Create a autocomplete input for counties
$county = new Zend_Dojo_Form_Element_ComboBox('county');
'autocomplete' => true,
'storeId' => 'countyStore',
'storeType' => 'dojo.data.ItemFileReadStore',
'storeParams' => array('url' => "/clients/client/autocomplete"),
'dijitParams' => array('searchAttr' => 'county')))
The code for my autocomplete action within the controller is as follows the query returns the ID and County for each county in the table, with the id of the table 'countiesID' being used as the id of the Zend_Dojo_Data element (if I understand what I've read from the web).
public function autocompleteAction()
// disable layout and view rendering
// get list of breed names from the breeds table
//generate and return JSON string
$data = new Zend_Dojo_Data('countiesID',$result,'county');
Many thanks in advance