Forums

Dynamic options checkbox group

ideagrup 01 Jul, 2015
Hello I have a event that runs correctly: A dropdown with JSON after read database values:
<?php
$results = array();
$results[] = 'coles';
foreach ( $form->data['coles'] as $v ) {
  $results[$v['co_registro']] = $v['co_nombre'];
}
echo json_encode($results);
?>

Is posible put the same values to a checkbox group field??
Thanks
GreyHead 01 Jul, 2015
Hi ideagrup,

Do you want to create this using AJAX after the form is loaded? If so then you can't use the built-in AJAX methods for a CheckBox group but you could do it with custom JavaScript.

Or do you want to set this up before the form loads - in that case, yes you can do it using the Dynamic Data tab of a Checkbox group action - but the results have to be formatted a bit differently.

Bob
ideagrup 01 Jul, 2015
Yes, first case.
I need after the form is loaded.

Do you know some sample og this in JavaScript used into crhonoforms??

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