Skip to content

Commit 28aa323

Browse files
committed
Don't forget to support the legacy framework & language versions! 💀
1 parent b96bc56 commit 28aa323

File tree

2 files changed

+3
-0
lines changed

2 files changed

+3
-0
lines changed

lib/html5_validators/action_view/form_helpers_rails3.rb

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ def to_input_field_tag_with_html5_attributes(field_type, options = {})
1818
if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
1919
options["required"] ||= object.class.attribute_required?(method_name)
2020
options["maxlength"] ||= object.class.attribute_maxlength(method_name)
21+
options["minlength"] ||= object.class.attribute_minlength(method_name)
2122
options["max"] ||= object.class.attribute_max(method_name)
2223
options["min"] ||= object.class.attribute_min(method_name)
2324
end
@@ -29,6 +30,7 @@ def to_text_area_tag_with_html5_attributes(options = {})
2930
if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
3031
options["required"] ||= object.class.attribute_required?(method_name)
3132
options["maxlength"] ||= object.class.attribute_maxlength(method_name)
33+
options["minlength"] ||= object.class.attribute_minlength(method_name)
3234
end
3335
to_text_area_tag_without_html5_attributes options
3436
end

lib/html5_validators/action_view/form_helpers_ruby1.rb

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ def inject_required_attribute
1010
def inject_maxlength_attribute
1111
if object.class.ancestors.include?(ActiveModel::Validations) && (object.auto_html5_validation != false) && (object.class.auto_html5_validation != false)
1212
@options["maxlength"] ||= @options[:maxlength] || object.class.attribute_maxlength(@method_name)
13+
@options["minlength"] ||= @options[:minlength] || object.class.attribute_minlength(@method_name)
1314
end
1415
end
1516

0 commit comments

Comments
 (0)