From 2896677af12f2f1e59ba475d50b66b14dd999098 Mon Sep 17 00:00:00 2001 From: vitorcastro Date: Sun, 28 Jun 2026 22:30:14 +0200 Subject: [PATCH] Clarify that browser_validations default differs between gem and generator The README states SimpleForm.browser_validations defaults to true, but the install generator explicitly sets it to false in the generated initializer. This is intentional (documented in the generator template's inline comment) due to inconsistent native HTML5 validation behavior across browsers, but this distinction was not mentioned anywhere in the README, leading to confusion. Adds a note clarifying the difference and how to restore the gem-level default if desired. Fixes #1746 --- README.md | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/README.md b/README.md index a15a9c05..b4ccb202 100644 --- a/README.md +++ b/README.md @@ -1173,6 +1173,11 @@ the browser validation: SimpleForm.browser_validations = false # default is true ``` +Note: while `true` is the default when SimpleForm is loaded, running `rails generate simple_form:install` +creates an initializer that explicitly sets this to `false`, as it is the recommended setting due to +inconsistent native validation behavior across browsers. If you want the default `true` behavior, remove +or comment out this line in `config/initializers/simple_form.rb`. + This option adds a new `novalidate` property to the form, instructing it to skip all HTML 5 validation. The inputs will still be generated with the required and other attributes, that might help you to use some generic javascript validation.