Ash FrameworkAF
Ash Framework7mo ago
1 reply
ggarciajr

Multiple checkbox form

I'm trying to implement https://fly.io/phoenix-files/making-a-checkboxgroup-input/ for a field that is a {:array, ;uuid}.
When generating the form, using AshPhoenix, I can see that form.data and form.source have values inside the field that will be used in the multi checkbox field.
However @value is always empty, so I can't tell if a given checkbox should be checked or not.

I circumvented the problem by passing defining the checked flag as a third element in the options array.
So, instead of passing [{"label", "value"}] as options , I'm passing [{"label", "value", true}]
This works fine, but I was wondering if there is something I'm missing here.

To generate the form, I'm using
resource
|> MyDomain.form_to_action()
|> AshPhoenix.Form.ensure_can_submit!()
|> to_form()
Fly
Creating a custom core_component input for tagging items using a multi-select checkbox group.
Making a CheckboxGroup Input
Was this page helpful?