You apparently can’t combine include_blank
and required
on a select box, which seems odd.
I can imagine we’d often want to give users a choice of options (with no default) but insist they pick one.
It looks like this is possible, although you have to do a bit of a workaround by using prompt
on the select box, which adds a “no value” option, and then give that no display value, e.g.
<%= form.select :name, options_for_select(options), { prompt: "" }, required: true %>
— John Norris
Who are Dragon Drop?
Dragon Drop is a specialist web and app development agency. The team has extensive full-stack technical credentials and a strong focus on user experience.
The Dragon Drop founding team have over 40 years of web development and project experience. They have managed or developed over 100 significant ecommerce and web projects during their careers, including implementations for major UK high street retailers, financial services companies and government agencies.
Their approach to innovative solutions stems from perspectives gained as retailer, software supplier and web agency.