We have this select:
我们有一个选择:
<%= form.input :contact_role_id, as: :select, collection: ContactRole.all %>
How would you disable it?
如何禁用它?
We have tried disabled: true
我们试过残疾:真的
1 个解决方案
#1
2
Try with 'html' => { :disabled => true }
, such as
尝试使用“html”=>{:禁用=> true},如。
<%= form.input :contact_role_id, as: :select, collection: ContactRole.all, 'html' => { :disabled => true } %>
From the docs, which talk about using disabled
but unfortunately does not give an example.
从文档中可以看出,它使用的是禁用的,但不幸的是没有给出一个示例。
#1
2
Try with 'html' => { :disabled => true }
, such as
尝试使用“html”=>{:禁用=> true},如。
<%= form.input :contact_role_id, as: :select, collection: ContactRole.all, 'html' => { :disabled => true } %>
From the docs, which talk about using disabled
but unfortunately does not give an example.
从文档中可以看出,它使用的是禁用的,但不幸的是没有给出一个示例。