I am writing a rails app and using simple form for forms. I have a form that has a user select answers to a question in the form of radio buttons. However, the form currently allows the user to submit an answer without choosing an option, even if I put requires true in the simple_form. Anyone have any idea how to actually require an answer first?
<%= simple_form_for @question do |f| %>
<%= f.error_notification %>
<%= f.association :answer, as: :radio_buttons, label_method: :name, required: true %>
<%= f.button :submit, "Submit" %>
<% end %>
Aucun commentaire:
Enregistrer un commentaire