You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Consider a following validation (field "bar" string |> andThen nonEmpty).
Initial value for the field is empty, but I would like the validation to kick off onBlur. So if user types something and later deletes it, she gets a validation error.
At the moment validation is only shown when the form is submitted or the field has some initial value.
Reading the source and it looks it's not possible at the moment. The definition of changed fields would need to get bumped for on blured fields. Or another field facet added to get this scenario handled.
To recreate:
use example https://github.com/etaque/elm-form/tree/master/example . If you change initial value for name field from hey to empty and recompile it you'll see that name validation is not happening onBlur anymore.
The text was updated successfully, but these errors were encountered:
Hi @takaczapka, I could be wrong, but it appears this is related to updates from #95.
In that pull request, fields that match their original value after update are removed from the set of changed fields. Since the current getLiveError function will only surface errors where the corresponding field is a member of the changed fields set, it is missing this scenario.
@etaque - Could the getLiveError function be updated to use the dirty tracking instead of the changed fields tracking? If we simply removed the code which removes the field from the dirty set on Blur and then update the getLiveError conditional from this:
isSubmitted form ||(isChangedAt name form && not (isDirtyAt name form))
to this:
isSubmitted form || isDirtyAt name form
Would that have impacts on other functionality? I am happy to post a PR, just wanted to check my approach first :)
Consider a following validation
(field "bar" string |> andThen nonEmpty)
.Initial value for the field is empty, but I would like the validation to kick off
onBlur
. So if user types something and later deletes it, she gets a validation error.At the moment validation is only shown when the form is submitted or the field has some initial value.
Reading the source and it looks it's not possible at the moment. The definition of changed fields would need to get bumped for
on blur
ed fields. Or another field facet added to get this scenario handled.To recreate:
use example https://github.com/etaque/elm-form/tree/master/example . If you change initial value for
name
field fromhey
to empty and recompile it you'll see thatname
validation is not happening onBlur anymore.The text was updated successfully, but these errors were encountered: