I am using SAFE for the first time, and I am struggling to find a way to update the model / state when a select / dropdown is clicked on by the user.
This is the code from the View section:
let view (model: PageModel) dispatch =
...
Bulma.select [
prop.children [
for (value, text) in plainData do
Html.option [
prop.value value
prop.text text
prop.onClick (fun _ -> dispatch (PlainDataChanged value))
] ] ]
The code above has no errors but the onClick event, which I hoped would send ‘value’ to Update Msg below, does not seem to send anything:
let update (msg: Msg) (model: PageModel) : PageModel * Cmd<Msg> =
match msg with
| PlainDataChanged indx -> { model with
serverState = Idle
dataModel = {model.dataModel with PlainIndex = indx }
}, Cmd.none
Equivalent code has worked fine for processing user input via radio buttons and from a textarea, and I am at a loss trying to work out how to send the ‘value’ when the dropdown / select element is changed. Any help gratefully received!