Reputation: 341
Can you guys help me with my little problem? this is my select tag:
<%= f.select :department_id, options_for_select(Department.in_order.map {|d| [d.name, d.id]}, obj.department_id), { prompt: true }, class: 'form-control input-sm', disabled: lambda {action_name == 'revise'} %>
if disabled: true
is set, I get "Department is invalid" error on my validation. When not set, everything is fine.
Upvotes: 2
Views: 310
Reputation: 162
This is due to the fact that HTML fields when disabled
are not submitted with the form. What you need is readonly
. Readonly gives you the same functionality as disabled but is still submitted with the form.
http://www.w3schools.com/tags/att_input_readonly.asp
Upvotes: 2