Hi. I have this code for population a group of checkboxes:
add_filter("gform_pre_render_7", "pre_survey");
function pre_survey($form){
global $wpdb;
$strSQL = 'SELECT name FROM wp_pod_tbl_treatment1 ORDER BY name';
$tmts = $wpdb->get_results($strSQL);
$i = 0;
foreach($tmts as $tmt) {
$i1 = $i+1;
$id = '10.' . $i1;
$form['fields'][5]['choices'][$i]['text'] = $tmt->name;
$form['fields'][5]['choices'][$i]['value'] = $id;
$form['fields'][5]['choices'][$i]['isSelected'] = ($_POST['input_10_' . $i1]);
$form['fields'][5]['inputs'][$i]['id'] = $id;
$form['fields'][5]['inputs'][$i]['label'] = $tmt->name;
$form['fields'][5]['inputs'][$i]['name'] = $id;
$i++;
}
return $form;
}
The problem is some checkboxes seems not to be stored or even kept when I go to next page and then go back to this page. Am I doing something wrong ?
Also, I would like on next page to show a question for every marked checkbox. Is this the correct hook where I can do this ? Is there any example in how to achieving this ?
Thanks.