I have a form that when submitted runs a sidekiq worker. Currently if you click submit on the empty form it attempts to run the worker. Whhat I want is for it to alert the user that the fields need to me required before being submitted.
I have tried adding :required => true to the form fields, but that doesnt work. Also I cannot add in validations in the model. What else could I do?
form
<%= form_for @call, :url => {:action => 'call_score_range'} do |f| %>
<%= f.label :enter_score_range_one %>
<%= f.number_field :score_range_one %>
<%= f.label :enter_score_range_two %>
<%= f.number_field :score_range_two %>
<%= f.submit "Submit" %>
<% end %>
Aucun commentaire:
Enregistrer un commentaire