我想禁用下拉列表中给出的默认选项。 例如下拉列表中有三个值
["Select a status", "Processing", "Completed"]
我想在“选择状态”上应用已禁用和已选择的属性。
你能告诉我怎么做吗?我无法在相同的值上使用这两个属性。
答案 0 :(得分:2)
您是否尝试过使用options_for_select
<%= select_tag(:city_id, options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum", :selected => "Super Platinum")) %>
答案 1 :(得分:1)
以下为我工作
<%= select("post", "person_id", options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum", :selected => "Super Platinum" )) %>