Gform_chained_selects_input_choice children not polulating properly

Any help much appreciated. I’m trying to use gform_chained_selects_input_choices filter to populate a chained select field (id-10) on a form (id=2) and see that the parent gets populated, but the children do not (see image). This Is my test code that I will expand when I get this working:
add_filter( “gform_chained_selects_input_choices_2_10”, “populate_select”, 10, 7);
function populate_select( $choices, $form_id, $field, $input_id, $chain_value, $value, $index){
if( $form_id != 2 ) return $choices;
$items = array();
$data = array(‘Try 1’ => array(‘Try Sub 1-1’, ‘Try Sub 1-2’),
‘Try 2’ => array(‘Try Sub 2-1’, ‘Try Sub 2-2’),
‘Try 3’ => array(‘Try Sub 3-1’, ‘Try Sub 3-2’));
$choices = array();
foreach ($data as $key => $sub_options) {
$parent = array(‘text’ => $key, ‘value’ => $key, ‘isSelected’ => FALSE, ‘choices’ => array());
foreach ($sub_options as $sub_option) {
$parent[‘choices’] = array(‘text’ => $sub_option, ‘value’ => $sub_option, ‘isSelected’ => FALSE);
}
$choices = $parent;
}
return $choices;
}

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.