I would like to show validation error only when field was visited but no valued is entered.
I know there are:
I would like to show validation error only when field was visited but no valued is entered.
I know there are:
You could use the blur event:
input [ on "blur" (Json.Decode.map FieldBlurred targetValue) ] []
This assumes a Msg constructor like this, which will receive the text of the text box on blur:
type Msg
= ...
| FieldBlurred String
Then in your update, handle the empty string appropriately:
case msg of
FieldBlurred "" -> ... -- invalid!
FieldBlurred val -> ... -- ok