I'm not sure if this is possible, but I'm trying to trigger html events with chained union types. I have the two union types below:
type DialogOf =
SearchItems
| SearchingItems String
| None
type Msg =
Start
| ShowDialog DialogOf
| CancelDialog
I handle the model update as follows, which works fine.
ShowDialog dialogOf ->
case dialogOf of
SearchItems ->
( { model | dialogOf = SearchItems }, Cmd.none)
SearchingItems filter ->
( {model | context = CurrentContext filter }, Cmd.none )
None -> (model ,Cmd.none)
Now when I fire the events, I want to fire SearchingItems with the filter (String) which can be done using the onClick for a button:
let searchWordButton item =
div [] [
button [ onClick (ShowDialog (SearchingItems item))] [text item]
]
Now I want to fire the onInput for the text box to filter on text input but I can't find any way to do this with the implicitly passed value - I'm trying to do something like this (not working):
div [] [ input [
value model.context.filter, onInput (ShowDialog SearchingItems) ] []
]
I realise there may be other better ways of handling this (like sub modules), but I'd like to know if there is a way to implicitly pass the string value with the onInput event using the chained union types above?
Thanks