How can I save the values of a checkboxes field in multiple rows

save multiple checkbox values as separate database rows.

Overview

The issue occurs when using a standard save data action, which stores all checkbox selections as a single array in one field.
Use the Loop data provider with the checkboxes field as the source, then reference the loop variable in the save data action to insert each value individually.

Answered
ChronoForms v7
wi wiva 07 Dec, 2020
I’m trying to make a attendance form to register the absence / presence of people in daycare
I just want to explore the possibilities of registering as simple as it can be for the people who has to fill in the form.
Afterwards I want to collect the data to count and calculate in MySQL.
In a simple form i have a calendar field to select the date and a (dynamic) checkboxes field to check the names of the person(s)

I save the data with a save data in a loop action
The data is saved in the table but all values in one field. [“4”,”6”,”7”,”12”] and a date field [2020-12-05]
I would like to save them in separate rows with one field one of the values and also the date field like
[“4”] , [2020-12-05]
[“6”] , [2020-12-05]
[“7”] , [2020-12-05]
[“12”] , [2020-12-05]
or even better
4, 2020-12-05
6, 2020-12-05
7, 2020-12-05

12, 2020-12-05
 How can I save the values of a checkboxes field in multiple rows image 1 How can I save the values of a checkboxes field in multiple rows image 2 How can I save the values of a checkboxes field in multiple rows image 3 How can I save the values of a checkboxes field in multiple rows image 4 How can I save the values of a checkboxes field in multiple rows image 5
Max_admin Max_admin 19 Dec, 2020
Answer
The Loop data provider should be the checkboxes data: {data:checkboxes_name} and then you use {var:loop_name.value} in the "Data sources" of the "Save data" to get each checkbox value!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
This topic is locked and no more replies can be posted.