I’m using ext.combobox.EJuiComboBox
to create a dropdownlist. When I use this I get the HTML as below :
<select id="SearchForm_max_cost_select" style="display: none;">
<option value="0"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
but I want it like this :
<select id="SearchForm_max_cost_select" style="display: none;">
<option value="0"></option>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
<option value="4">four</option>
<option value="5">five</option>
<option value="6">six</option>
</select>
I’m using the below code,
<?php
$this->widget('ext.combobox.EJuiComboBox', array(
'model' => $model,
'attribute' => 'min_cost',
'data' => array('1','2','3','4','5','6'),
'options' => array(
'onSelect' => 'cost_change(item.value);',
'allowText' => false,
),
'htmlOptions' => array('placeholder' => 'Min Cost', 'style'=>'width:70px'),
));
?>
How can I do this?
Hi
Here is a example
<select id="myselect">
<option value="1">Mr</option>
<option value="2">Mrs</option>
<option value="3">Ms</option>
<option value="4">Dr</option>
<option value="5">Prof</option>
</select>
the value to be sent to the server
$( "#myselect" ).val(); // => 1
[size="2"]If you wanted to get the string "Mr" if the first option was selected[/size]
$( "#myselect option:selected" ).text(); // => "Mr"
<?php
$this->widget('ext.combobox.EJuiComboBox', array(
'model' => $model,
'attribute' => 'password',
// data to populate the select. Must be an array.
//'data' => $model->getAllModels(),
'data' => array('yii','is','fun','!'),
// options passed to plugin
// Options passed to the text input
'options' => array(
// JS code to execute on 'select' event, the selected item is
// available through the 'item' variable.
'onSelect' => 'alert("selected value : " + item.value);',
// JS code to be executed on 'change' event, the input is available
// through the '$(this)' variable.
'onChange' => 'alert("changed value : " + $(this).val());',
// If false, field value must be present in the select.
// Defaults to true.
'allowText' => false,
),
// Options passed to the text input
'htmlOptions' => array('size' => 10),
)); ?>
[size=2]Hello Chandran,[/size]
I want the HTML to be generated like :
<select id="SearchForm_max_cost_select" style="display: none;">
<option value="0"></option>
<option value="1">one</option>
<option value="2">two</option>
<option value="3">three</option>
<option value="4">four</option>
<option value="5">five</option>
<option value="6">six</option>
</select>
But, it is generated as below,
<select id="SearchForm_max_cost_select" style="display: none;">
<option value="0"></option>
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
<option value="4">4</option>
<option value="5">5</option>
<option value="6">6</option>
</select>
Now, for the dropdownlist, I’m passing
'onSelect'= 'cost_change(item.value)';
.
Hi,
There is a small misunderstood. You can achieve this by below code
// data to populate the select. Must be an array.
'data' => array('1'=>'one','2'=>'Two') // ..and continues
'assoc'=>true,
[size=2]Still no change. Same is the HTML generated[/size]
<select id="SearchForm_min_cost_select" style="display: none;">
<option value="0"></option>
<option value="one">one</option>
<option value="Two">Two</option>
</select>