diff --git a/lib/simple_form/action_view_extensions/form_helper.rb b/lib/simple_form/action_view_extensions/form_helper.rb index f32f6c65..211c3e05 100644 --- a/lib/simple_form/action_view_extensions/form_helper.rb +++ b/lib/simple_form/action_view_extensions/form_helper.rb @@ -40,7 +40,9 @@ module SimpleForm else dom_class(record_or_name_or_array) end options[:html] ||= {} - options[:html][:novalidate] = !SimpleForm.browser_validations if options[:html][:novalidate].nil? + unless options[:html].key?(:novalidate) + options[:html][:novalidate] = !SimpleForm.browser_validations + end options[:html][:class] = "\#{SimpleForm.form_class} \#{css_class} \#{options[:html][:class]}".strip with_custom_field_error_proc do diff --git a/test/action_view_extensions/form_helper_test.rb b/test/action_view_extensions/form_helper_test.rb index b8e76d75..31914732 100644 --- a/test/action_view_extensions/form_helper_test.rb +++ b/test/action_view_extensions/form_helper_test.rb @@ -26,13 +26,13 @@ class FormHelperTest < ActionView::TestCase end test 'a form specific disabled validation option should override the default enabled browser validation configuration option' do - concat(simple_form_for(:user, :html => {:novalidate => true}) do |f| end) + concat(simple_form_for(:user, :html => { :novalidate => true }) do |f| end) assert_select 'form[novalidate="novalidate"]' end test 'a form specific enabled validation option should override the disabled browser validation configuration option' do swap SimpleForm, :browser_validations => false do - concat(simple_form_for(:user, :html => {:novalidate => false}) do |f| end) + concat(simple_form_for(:user, :html => { :novalidate => false }) do |f| end) assert_no_select 'form[novalidate]' end end