forms - Setting values for multi select elements in magento custom module -
I am developing a custom module in Magnomen and having difficulty defining options for multi-select elemets
$ this-> _addFieldsToFieldset ($ fieldset, array ('cities' = & gt; array ('label' = & gt; $ this- & gt; __ ('city'), 'input' = & gt; 'multiselect', 'required' = & Gt; true, 'option' => $ zone solver-> getAvailableCities (),),)); Like ... and getAvailableCities (),
$ read = Dana :: getSingleton ('core / resources') - & gt; GetConnection ('core_read'); $ Result = $ read-> Receive (choose from all "districts"); $ Option = array (); Forex currency ($ result as $ line) {$ option [$ row ['city_id']] = $ line ['city']; } Return the $ option; } But multi-selection element is shown but there is no population in the form. But if I wanted to set it as a general select element then it would be populated.
For anyone else on the same issue
$$ - & gt; _addFieldsToFieldset ($ fieldset, array (
'cities' = & gt; array ('label' = & gt; $ this- & gt; __ ('city'), 'input' = & Gt; Multipurpose ',' expected '=> true,' value '= & gt; $ zone error-> getAvailableCities (),),)); The above options should change the values and the values array should be in the following format
$ options [==] ('value' = & gt ; $ Line ['city_id'], 'label' = & gt; $ line ['city']);
Comments
Post a Comment