Reputation: 187
I want to be able to disable a select option that in essence can be used as a placeholder. :prompt does not seem to work for me as this is still a selectable option.
It html, what I want would be:
<select class="selectpicker">
<option value="" disabled selected style='display:none;'>Difficulty</option>
<option value="b">Beginner</option>
<option value="i">Intermediate</option>
<option value="a">Advanced</option>
</select>
In rails all I have is:
<%= f.select(:difficulty, [['Beginner', 1], ['Intermediate', 2], ['Advanced', 3]], {}, { :class => 'selectpicker' }) %>
http://jsfiddle.net/chapster82/QL6D7/
Thanks for any help.
Upvotes: 1
Views: 960
Reputation: 187
I think I figured it out but is this correct?
<%= f.select(:difficulty, [['Difficulty', '0'], ['Beginner', 1], ['Intermediate', 2], ['Advanced', 3]], {:disabled => 0, :selected => 0}, { :class => 'selectpicker' }) %>
Upvotes: 1