Skip to content
Permalink
Browse files

bugfix min length

  • Loading branch information...
angusmcleod committed Jun 11, 2019
1 parent 7d04ffb commit 620f30368e1ed1d4b79d0353dbee7a5ac2efb2a7
Showing with 9 additions and 1 deletion.
  1. +9 −1 lib/builder.rb
@@ -227,7 +227,11 @@ def build_dropdown_list(field, field_template)

def validate_field(field, updater, step_template)
value = updater.fields[field['id']]
min_length = field['min_length']
min_length = false

if is_text_type(field)
min_length = field['min_length']
end

if min_length && value.is_a?(String) && value.strip.length < min_length.to_i
label = field['label'] || I18n.t("#{field['key']}.label")
@@ -246,6 +250,10 @@ def validate_field(field, updater, step_template)
end
end

def is_text_type(field)
['text', 'textarea'].include? field['type']
end

def standardise_boolean(value)
!!HasCustomFields::Helpers::CUSTOM_FIELD_TRUE.include?(value)
end

0 comments on commit 620f303

Please sign in to comment.
You can’t perform that action at this time.