Last Updated: February 25, 2016
·
1.647K
· anriettec

Chronoforms: loading up database values created by a multiselect

I’m in the thick of developing a complex step-based application form for a scientific organisation. I’ve decided to use Chronoforms as I’ve had nothing but good experiences from this extension.

Recently, I started working on the update process where users can return and edit certain steps before submitting.

A big thanks to Greyhead and his colleagues who created this awesome and flexible component.

Well, on my first step I had a multiselect which generated a comma-delimited list upon save in the database. When recalling the record, the multiselect didn’t seem to show the selected values. What I did to make it show up was simply introduce the following Custom Code in the On Load event.

<?php
$form->data['fields_practice'] = explode(',', $form->data['fields_practice']);
?>

This exploded the comma-delimited list to an array which was then usable by Chronoforms to populate the multiselect with the appropriate values.

2 Responses
Add your response

Hi,

Can you tell us in which file we have to modify the form data as mentioned by you.

Thank You,
Amit

over 1 year ago ·

This all happens in a Custom Code section in the On Load event in the Wizard side of your form. This assumes your form is set to be Wizard mode and Advanced type of form.

I find it easiest to set up the form with the Easiest setting and when all is said and done (i.e. basics are set up), converting it to an Advanced type form.

See image for location of event: http://imgur.com/ftFGZHy

over 1 year ago ·