Yii - How To Insert A Placeholder In The Dropdownlist

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



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.



       // Keep a copy of the default options

        var $options = jQuery('#SearchForm_min_cost').children().clone();





        // Within your change handler:


            var index = jQuery(this).find(':selected').index();







How can I not include this values along with the list. I want them to be as placeholder and not in the list.

I tried prompt also, even this is included in the selection list.


    'prompt'=>'Please select the minimum value',


I don’t think you can do what you want with a standard HTML select box.

Why do you want to avoid including the prompt as a selectable option? If the prompt entry is chosen, it will have the same effect as leaving the drop down list empty, so you can ensure a valid value is selected by having a ‘required’ rule for that field.