Lets say I have a xano db table for products and another one for tags. One field in the products table includes a list of table references to the tags table. On default the list for tags in the products table is empty.
In Toddle I have a form to add a new product and the form includes all the available tags that are rendered based on my get_tags api. Each tag has an id, a name and a boolean called 'added' that is always false (just to make it easier for myself). On change (I use checkboxes with labels) I want to add the tag and when I uncheck I want to remove it. Obviously I don´t want to add or remove any tag if the product form is not completely filled out (name, description, etc) because the product is gets created on form submit.
How would you go about this?
My approach was:
1) create a variable called tags_array which is just an empty array
2) render the checkboxes based on the api and also set the value based on the api
3) try (emphasis on try!) to and or remove the tags_id based on the value of the checkbox.
The problem is that my formula adds tags but doesn´t remove them when I uncheck the checkbox. How can I solve this or has anyone a better approach?
Thanks