diff --git a/lib/builder.rb b/lib/builder.rb index 10c76810..13434d28 100644 --- a/lib/builder.rb +++ b/lib/builder.rb @@ -227,7 +227,11 @@ class CustomWizard::Builder 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 @@ class CustomWizard::Builder 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