Create a new data thing for each checkbox checked in a form

Hello everyone,

I have three tables :
Category-Group - an assocation table (many-to-many relation)

A group can have multiple categories and categories can have multiple groups.

I have a form with checkboxes in a RepeatingGroup. It’s a list of all the Categorys (dynamic data source)

Do you guys know a way to check multiple categories, and add a new entry for the table Category-Group for each checkboxes selected, at submission ?

I’ve searched for hours now, trying states, but nothing fits.
I could delete/create a new entry each time a checkbox is checked/unchecked , but it seems very innapropriate.

Thanks, I’m lost

I’d love to help but I’m still a little confused on what you’re trying to do. I’ve built an app with a similar feature (I think) but I want to be sure I’m understanding what you need before I start taking a stab at it. Can you give me a real-world use case so I can wrap my head around it a bit more?

I suspect this has a lot to do with how your database is structured. Do your Category entries contain a nested list of Groups, and vice versa? (that’s how I did it).

Let me know.

Thank you for your response.

The user is supposed to select a few categories that are attached to the group.
e.g. : if he creates a group for “skiing”, the categories “Sport” and “Snow” should be selected.

I did’nt create nested list of group because it’s not optimized. I’ve set an association table.
There is a table Category-Group that have the category’s id associated to a group’s id

If I take the example again :
Cateogry’s name = Sport
Group’s name = skiing
Category-Group’s entry (with two separate fields) : Sport and skiing

Here is an example image of that system

Basically, I don’t know how to save a list of checkboxes value within a repeated group in the database.

Is it clear ? Tell me if you have another solution !

Nevermind, with you can create list fields without worrying about th performance
see “Join table or list field for many to many relationship