Need some help with dynamically checked checkboxes that are used to filter a database query.
The checkbox form group list used for filtering the database is a dynamic list, which is populated by a server action and a repeat on the form’s Checkbox Control element. That works fine, also the filtering works well when a checkbox is clicked. So far so good
Now, I want to dynamically check some of the checkboxes if their value is set in a query parameter. Following this doc that should be possible by setting the value of the checkbox group to
query.[parameter name] in the checkbox group properties, like I did:
The parameter was also added to the content pages’ query parameters by the way as well as on the layout page (I’m on NodeJS).
When I output the value of the checkbox group however, it’s empty. That is, it is empty on page load with a query parameter set, but it is populated with value when checkboxes are clicked of course. So on page load the checkbox group value is always empty, therefore the checkboxes are also not automatically checked and the database is not filtered by this value either.
I think it probably has something to do with the checkbox group value being an array instead of a single value. Should the
query.cat value (if only one) be transformed to another format possibly? Or if not, what else could be wrong here?
Thanks for any help in advance!