I’m new to Yii framework. I created dropdownlists using the below code -
echo $form->dropDownList($model, 'min_cost', Yii::app()->params['cost_resales']);
echo $form->dropDownList($model, 'max_cost', Yii::app()->params['cost_resales']);
Now, I cannot insert a place holder, in the above dropdownlists. I tried using the below htmloptions to insert placeholder
array('empty'=>'Min')
array('empty'=>'Max')
This works fine. But , this values get included in dropdownlist also. I don’t want them to be included in dropdownlist.
I’m using the below Jquery code to populate the dropdownlist values.
<script>
jQuery(function(){
// Keep a copy of the default options
var $options = jQuery('#SearchForm_min_cost').children().clone();
jQuery('#SearchForm_min_cost').change(function(){
// Within your change handler:
var index = jQuery(this).find(':selected').index();
jQuery('#SearchForm_max_cost').html($options).children(':lt('+index+')').remove();
});
});
</script>
How can I not include this values along with the list. I want them to be as placeholder and not in the list.