Html.Events.on
takes a Decoder msg
as its second argument and JD.map (UpdateRecVal recId currVal) JD.string
is a valid Decoder msg
. However it will fail to decode an event, as it is not a string, and therefore the message won’t go to update
, as documented in Html.Events.on
.
Also note that targetValue
is just JD.at ["target", "value"] JD.string
.
So everything is fine at compile time, the decoder failure only occurs at runtime.
What compilation error would you have expected?
PS: have a look at Json.Decode debug helpers for some helpers to debug decoders.