reform
reform copied to clipboard
Coerced values remain in the form when rerendering the view on failed validation
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