Checkbox group saved btu nor retrieved

Load saved checkbox group values in ChronoForms v5.

Overview

The issue occurs because ChronoForms v5 does not automatically explode the saved comma-separated string back into an array when loading the form data.
Add a Custom Code action in the form's On Load event after the DB Read action to manually explode the saved string into an array for the checkbox group.

Answered
si simelas 06 Dec, 2014
HI Bob,
Created forms with chronoforms V5 containing checkbox group, textboxes, etc,...

Checkbox group boxes labels are coming from a table via dynamic data read.

Ticked checkboxes correclty saved ( as well as other fields) in the database via handle array and db save action.

Issue: When loading form ( access the record via id) , checkbox group boxes do not load ( blank boxes only) while other fields are correctly loaded.

Is there any need for some "explode" coding ? The handle array apparently only implode.

Best rgds,

simelas
Gr GreyHead 06 Dec, 2014
Hi simelas,

In CFV4 there was a option box you could use. I don't see that in CFv5 - but I also haven't seen the problem reported here before :-(

Please add a Debugger action in the On Load event just before the HTML (Render form) action and see what that shows.

Bob
si simelas 06 Dec, 2014
Hi Bob,

I had played with debbuger and it showed that data is correctly loaded by load action but do not transfer to the checkbox. Hence wondering if some explode is needed somewhere or maybe missing in CFV5 to properly populate checkboxes. (or if i missed something...)

( Same form in CFV4 works perfectly well as expected).

Best Regards,

Simelas
Gr GreyHead 07 Dec, 2014
1 Likes
Hi simelas,

Please try adding a Custom Code action to the form On Load event after the DB Read action and before the HTML (Render Form) action with code like this:
<?php
$form->data['input_name'] = explode(',', $form->data['input_name']);
?>
Replace input_name with the name of the array input and, if necessary, change the ',' to match the separator used in your string.

Bob
si simelas 07 Dec, 2014
Answer
Hi Bob,

thanks for the confirmation ( in the meantime i had came to the same solution). Works ok .

My i suggest that Max adds an explode array option within the handle array for CVF5.....

Time for a nice drink now.

Cheers

Simelas
This topic is locked and no more replies can be posted.