Cakephp 2.5.1 form input order of values -


$getcities = $this->requestaction('objekts/getcities'); 

this returns me list ids , names of cities in alphabetical order. when debug $getcities can see alphabetical order.

this way how select data:

 $results = $this->find('list', array(             'conditions' => array($and, $andzone),             'fields' => 'reg_id, reg_name',             'group' => 'reg_id',             'order' => array('reg_name asc')         )); 

again, debug data in alphabetical order.

but!

echo $this->form->input('city', array('label' => __('nach ort suchen'), 'empty' => __('bitte wählen'), 'options' => $getcities, 'id' => 'city', 'class' => 'styled-select')); 

this changing order it's id's , not keep alphabetical order on city names.

is there can add $this->form->input set order names instead of ids?

please advice!

thanks!!

edit:

this debug array

'{"4":"alar\u00f3","67":"algaida","99":"alqueria blanca","5":"andratx","6":"art\u00e1","8":"bendinat","105":"biniali","9":"binissalem","70":"bunyola",..... 

this html output

<select id="city" class="styled-select" name="data[objekt][city]"> <option value="">bitte wählen</option> <option value="4">alaró</option> <option value="5">andratx</option> <option value="6">artá</option> .... <option value="67">algaida</option> ... <option value="99">alqueria blanca</option> .... 


Comments

Popular posts from this blog

php - Submit Form Data without Reloading page -

linux - Rails running on virtual machine in Windows -

php - $params->set Array between square bracket -