Forums

Checkbox group - Dynamic Data - Default values

patryk 19 Aug, 2013
Hi All,

I've a checkbox group which is populated with data in the onLoad event (that part works fine).
But now, I would like to set the default value for some of the check boxes, so in different words,
I would like to set their checked status to true.

When Dynamic Data is not used, it's possible to specify the checkboxes which should be checked by default in the "Checked value" text field (by typing there a list of checkbox values) - is there something similar, when Dynamic Data is being used?

Regards,
Patryk
GreyHead 19 Aug, 2013
Hi patryk,

I'd expect that the 'Checked Value' would still work - but I guess from your post that it doesn't. You could probably use a Custom Code action to add the values you need to the $form->data array (though I guess that you'd also have to check that the Dynamic Data hadn't already set other values).

Bob
patryk 20 Aug, 2013
Hi Bob,

thank you for your prompt answer.

Regarding 'Checked value': what I meant was that I don't know how to specify which values should be checked, when using Dynamic Data.

An example: joomla user 'jsmith' opens a form - so I would like to have values a,b,c,d checked by default.

But, if a user 'jdoe' opens a form, then I would like to have only a,b,c checked by default.

What should be checked by default for each user is stored in a database table.

Currently, I'm thinking about registering a javascript event which will be triggered when the page is loaded and it'll query the database and basing on this info it'll check the required checkboxes.

But I was hoping for a simpler solution🙂

Regards,
Patryk
GreyHead 20 Aug, 2013
Hi Patryk,

The ChronoForms republisher should do that for you if the DB Multi-Record Loader is in the form On Load event before the Show HTML action.

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