Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Coerced values remain in the form when rerendering the view on failed validation #450

Open
bolstycjw opened this issue Jan 10, 2018 · 0 comments
Labels
Milestone

Comments

@bolstycjw
Copy link

Complete Description of Issue

When using coercion with Reform, the raw date strings are coerced into Date types during validation. If validation fails, the values remain as the coerced types. This results in incorrect date format display when the form is rerendered on the view.

Steps to reproduce

class FooForm < Reform::Form
  feature Coercion

  property :date, type: Types::Form::Date

  validation do
    required(:date).filled(:date?)
  end
end

Expected behavior

Reform should revert the form values to their original raw input when validation fails.

Actual behavior

Form values are persisted in the form object even if validation fails and input is invalid.

System configuration

Reform version: 2.2

@emaglio emaglio added bug and removed to investigate labels Sep 8, 2019
@emaglio emaglio added this to the 3.0 milestone Sep 8, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants