I'm rebuilding my Chronoforms v4 forms in Chronoforms v7. That's a major difference. The form-results are being stored into a db, but I'm having problems with saving checkboxes. The db-field is a varchar(255).
In Chronoforms v4 I needed to add a 'Handle arrays' action before storing data to a db. I can't find such an option in Chronoform v7. Runnig the form gives an error 1054. This is caused by the checkbox. Without it is runs good and the data is stored into the db.
How can I fix this?
that error should be solved in the next update, but for now, you may add a "Data source" and set the field name to match the table field name, and the value to:
{data:checkboxes_name}
and the value type to "JSON Encode"
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
How do I add a "data source". I can't find anything at the advanced settings or behavior of the field. I can see there's a 'Save data' behavior, but I can't configure that.
Regards, Hans
when do you need this working ? the new update should fix it without any changes, it's supposed to be ready this weekend!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
That will be soon enough Max, no hurry.
Great!
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
Hi Max,
Thanks for the CF7 update. This fixed the issue partially. The array is stored in the db, thats fine. However, the result is not quite correct.
I've got a checkbox with to possible options: (1) Zomerlid (2) Winterlid.
This is how it's stored in the db field:
["Zomerlid","Winterlid"]
It must be without the brackets ([ ]) and quotes (""). Is this something I can fix myself, or still a bug?
Regards, Hans
that's the correct value, it's JSON encoded, you better leave it as it's now, because this makes it easier to read the values later as an array!
How do you preview the table data usually ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
The form is used for new members to register. Usually I only to send the form-information in an e-mail to our secretary and store the data in case information got lost. After payment is done, I register the user as Community Builder-user, which automatically creates a Joomla-user. I'm trying to automate creation of a CB-user. In CB, this field is also a checkbox. The data is stored as:
zomerlid|*|winterlid
When I use the format which is used in CF7, CB doesn't work correct and the information is display incorrect.
Hans
You may customize the value using PHP or shortcodes, what is "|*|" in the value ?
Max, ChronoForms developer
ChronoMyAdmin: Database administration within Joomla, no phpMyAdmin needed.
ChronoMails simplifies Joomla email: newsletters, logging, and custom templates.
It's part of the array-delimiter. It's a multiple-checkbox field in Community Builder, which has four possible values. When I use all values, this is the result:
zomerlid|*|winterlid|*|erelid|*|niet-spelend lid
I'm struggeling with two modules (Chronoforms and Community Builder) who handles arrays differently while using the same db-table.
You helped me how to retrieve stored array results in an formfield, which works when its JSON-coded. But when it's stored in the format as mentioned above, I don't know how to use this in CF.
I think I'm one step further. After the read-data action I've added a PHP-action, as suggested by Max.
I can use this statement to convert the data to a proper array-format:
explode("|*|", $this->get('gebruiker.cb_lidmaatschap'))
I've tested this code in the PHP-action:
$var = explode("|*|", $this->get('gebruiker.cb_lidmaatschap))
foreach ($var as $value) {
echo $value;
}
Then all values are displayed.
If I know how to get this result into a multi-checkbox formfield, I've got what I want.
Got it. This is my solution:
$lidmaatschap = explode("|*|", $this->get('gebruiker.cb_lidmaatschap'));
$this->data('gebruiker.cb_lidmaatschap', $lidmaatschap, true);