Reputation: 136
In my code, i have the following drop list
<%= f.collection_select :manufacturer_id, @manufacturers, :id,
:name,{include_blank: "Select manufacturer", required: true}, {class: "form-control"} %>
Somehow the blank is accepted as a selection. Is there a way to prevent this? I want the user to select a value form the drop-list, except for the blank.
Thanks for the help!
Upvotes: 0
Views: 34
Reputation: 569
Required is an html parameter. Try:
<%= f.collection_select :manufacturer_id, @manufacturers, :id,
:name,{include_blank: "Select manufacturer"}, {class: "form-control", required: true} %>
Upvotes: 2