Simple_form: Rails 5.1 "Use at least 255 characters"

Created on 7 Jun 2017  路  6Comments  路  Source: heartcombo/simple_form

Every input_field I add to a form which is a thing field gets the above error on submit.

Have no idea why as was working ok before and can't think what I might have added to cause it. Anyone seen this issue?

Hutch

Most helpful comment

The problem updating is solved running a fresh rails generate simple_form:install after the update, if you don't mind for your previous customization.

All 6 comments

An update must have caused it but this fixed it

  config.wrappers :default, class: :input, hint_class: :field_with_hint, error_class: :field_with_errors do |b|
    ## Extensions enabled by default
    # Any of these extensions can be disabled for a
    # given input by passing: `f.input EXTENSION_NAME => false`.
    # You can make any of these extensions optional by
    # renaming `b.use` to `b.optional`.

    # Determines whether to use HTML5 (:email, :url, ...)
    # and required attributes
    b.use :html5

    # Calculates placeholders automatically from I18n
    # You can also pass a string as f.input placeholder: "Placeholder"
    b.use :placeholder

    ## Optional extensions
    # They are disabled unless you pass `f.input EXTENSION_NAME => true`
    # to the input. If so, they will retrieve the values from the model
    # if any exists. If you want to enable any of those
    # extensions by default, you can change `b.optional` to `b.use`.

    # Calculates maxlength from length validations for string inputs
    # and/or database column lengths
    b.optional :maxlength

    # Calculate minlength from length validations for string inputs
    b.optional :minlength

    # Calculates pattern from format validations for string inputs
    b.optional :pattern

    # Calculates min and max from length validations for numeric inputs
    b.optional :min_max

    # Calculates readonly automatically from readonly attributes
    b.optional :readonly

    ## Inputs
    b.use :label_input
    b.use :hint,  wrap_with: { tag: :span, class: :hint }
    b.use :error, wrap_with: { tag: :span, class: :error }
  end

I have same problem

Just add the stuff above into the file config/initializers/simple_format.rb, adjust if needed, solved the problem straight away as it makes everything optional

The problem updating is solved running a fresh rails generate simple_form:install after the update, if you don't mind for your previous customization.

It seems like resolved. I going to close this issue, you can open a new issue if necessary.

This is not really fixed.
A new install simply declares minlength as optional and thereby disables it.
minlength is still broken.
The fix is described in #1531

Was this page helpful?
0 / 5 - 0 ratings

Related issues

sarunw picture sarunw  路  4Comments

frankyston picture frankyston  路  4Comments

mszyndel picture mszyndel  路  5Comments

Naokimi picture Naokimi  路  4Comments

gmrash picture gmrash  路  3Comments