2

我想禁用下拉列表中给出的默认选项。例如下拉列表中有三个值

["Select a status", "Processing", "Completed"]

我想在“选择状态”上应用禁用和选定的属性。

你能告诉我怎么做吗?我无法在相同的值上使用这两个属性。

4

2 回答 2

2

您是否尝试过使用options_for_select

<%= select_tag(:city_id, options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum", :selected => "Super Platinum")) %>
于 2013-04-17T13:46:59.983 回答
1

以下对我有用

<%= select("post", "person_id", options_for_select(["Free", "Basic", "Advanced", "Super Platinum"], :disabled => "Super Platinum", :selected => "Super Platinum" ))  %>
于 2013-04-17T14:07:26.083 回答