4
votes

I have a simple form, I have made the name field required, however, I am still able to submit this form without providing a name. The HTML validations are not kicking in.

<%= simple_form_for @company do |f| %>
  <%= f.input :name, required: true %>
  <%= f.button :submit %>
<% end %>

Is there something wrong with the simple form syntax here?

1

1 Answers

5
votes

What worked for me was to enter the simpleform initializer configuration i.e config/initializers/simple_form.rb and then change config.browser_validations to true.

I think it's turned off by default for some reason