I’m new to Yii and I’m using the below code to create a dropdownlist.
<?php
$this->widget('ext.combobox.EJuiComboBox', array(
'model' => $model,
'attribute' => 'max_cost',
// data to populate the select. Must be an array.
'data' => Yii::app()->params['cost_max_rental'],
// options passed to plugin
'options' => array(
'allowText' => false,
),
// Options passed to the text input
'htmlOptions' => array('placeholder' => 'Max Cost', 'style'=>'width:70px'),
));
//echo $form->dropDownList($model,'city', Yii::app()->params['city'], array('style'=>'width:120px'));
?>
Now, the HTML generated is
<select id="SearchForm_max_cost_select" style="display: none;">
<option value="0"></option>
<option value="300000.0">300000.0</option>
<option value="400000.0">400000.0</option>
<option value="500000.0">500000.0</option>
<option value="600000.0">600000.0</option>
</select>
Now, why is the option value not mentioned as 0, 1, 2, 3. How can I change it
<select id="SearchForm_max_cost_select" style="display: none;">
<option value="0"></option>
<option value="1">300000.0</option>
<option value="2">400000.0</option>
<option value="3">500000.0</option>
<option value="4">600000.0</option>
</select>