Reputation: 826
I want to disable the default option given in dropdown list. e.g. There are three values in dropdown list
["Select a status", "Processing", "Completed"]
I want to apply disabled and selected properties on "Select a status".
Can you please tell me how to do this? I am not able to use both the properties on same value.
Upvotes: 2
Views: 222
Reputation: 47482
Following works for me
<%= select("post", "person_id", options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum", :selected => "Super Platinum" )) %>
Upvotes: 1
Reputation: 2034
Have you tried using options_for_select
<%= select_tag(:city_id, options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum", :selected => "Super Platinum")) %>
Upvotes: 2