How to read db-array in CF7 formfield?

How to use a stored database array as default values in a ChronoForms checkboxes field.

Overview

The issue occurs when an array stored as a JSON-like string in a database field is not properly decoded for use as default values in a form.
Enable the "Populate fields" setting in the Read Data action and name the form field to match your database model and column. Then, set the field to JSON decode in the Read Data "Special fields" advanced settings. Alternatively, use the "Dynamic selections" option in the Checkboxes advanced settings.

Answered
ChronoForms v7
hp hpeterse 18 Dec, 2020
I've stored the result of a checkboxes-field in a database-field , type varchar. Result is an array which is stored as: ["value 1", "value 2"].

I would like to use this stored value as a default-value in a checkboxes-formfield. How do I do that?
Max_admin Max_admin 19 Dec, 2020
1 Likes
the easiest way is to name your field Model.table_file_name, and enable the "Populate fields" setting in the Read data, also the field should be set to JSON decode in the Read Data "Special fields" advanced setting!

Another way is using the "Dynamic selections" in the Checkboxes advanced settings!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
hp hpeterse 19 Dec, 2020
Answer
1 Likes
I had to figure some things out. I guess you meant that I should name the field Model.table_field_name (not file), after that it worked. Thanks Max.

Regards, Hans
Max_admin Max_admin 20 Dec, 2020
yes!
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.