Checkboxes in Elm Bootstrap Package

Hi folks,

I was trying to implement some checkboxes via Bootstrap.Form.Checkbox - elm-bootstrap 5.2.0

I basically want to use the same “Msg” type when two (or more) checkboxes are ticked. But I am struggling how to pass more information from my View to my model. I.e. onCheck only has the True/False value of the box as an argument.

If I try to pass more “arguments” to onCheck I hit

But `onCheck` needs the 1st argument to be:

    Bool -> msg

I essentially want to just flip a boolean within my model, and given the Msg is doing the same thing I thought I could use a common Msg. I.e. perhaps I could define a couple of Msg types but what if I have 100 checkboxes? I see there is a field but don’t see that I can make use of that.

Can I work around it with this does anyone know, or do I need to do checkboxes in another way?
I see Forms in Elm — Validation, Tutorial and Examples — Part 3 | by Lucamug | Medium is sort of doing what I want but I was hoping to use this Bootstrap stuff if possible.

Or am I using completely the wrong thing if I want to use checkboxes in this way.


Something like this: ?

1 Like

Thank you so much for taking the time! Great answer. A classic example of currying (I think?), which I had read about, and did contemplate briefly and couldn’t quite figure out for this example. And I got distracted by other fields, and looking up the source code for the bootstrap library etc.