I'm trying to create a checkbox outside of a form, just to bind a JS function on it using Lwt_js_events.clicks.
I've tried using bool_checkbox_one, but I can't figure out a way to generate the ~name: parameter for that. I found some post here where someone was explaining you actually can't, and should use the raw_ version, but that doesn't seem to exist anymore. I did find mention of a Html.D.Raw module, but I can't figure out how that works, and the doc is all kind of outdated on that.
The other thing I tried is using this :
let checkbox = input ~a:([a_input_type `Checkbox] @
(if t.status then [a_checked ()] else [])) () in
Now obviously that's not really pretty, but it works, it does generate a proper checkbox that works fine for what I want, but when I call Eliom_content.Html.To_dom.of_element on that on the client, I get an object on which I can't call ##checked to know if the checkbox is ticked or not (which looks possible on bool_checkbox_one). I also tried using ##hasAttribute to try and see if it has "checked", but apparently that's not updated when I tick the checkbox, not sure why.
In any case, what would be the proper way to do it ? Thanks
Figured out a way to use ##checked :
Js.to_bool (Js.Unsafe.get elt "checked"))
Js.Unsafe.get seems to allow getting arbitrary properties of a dom element, not exactly as good as using a proper checkbox I guess, but it works.