Hi, i populate some values in a list field and checkboxes dynamically in a multipage form.
for example, these two fields:
//list field
add_filter( 'gform_column_input_1_1_1', 'dynamic_field_populate', 10, 5 );
function dynamic_field_populate( $input_info, $field, $column, $value, $form_id ) {
return array( 'type' => 'select', 'choices' => 'ABC ,EFG' );
}
//checkboxes field
add_filter( 'gform_column_input_content_1_1_2', 'checkbox_field', 10, 5 );
function checkbox_field( $input_info, $field, $column, $value, $form_id ) {
$input_field_name = 'input_0';
$new_input = '<div class="gfield_checkbox" id="input_' . $form_id . '_'. $field["id"] .'[]">';
$new_input .= '<div class="gchoice gchoice_1_1_2_0" style="justify-content: center;">
<input class="gfield-choice-input" name="' . $input_field_name . '" type="checkbox" value="No" id="choice_1_1_2_0" '. GFCommon::get_tabindex() .' aria-label="wpa" data-aria-label-template="">
<label for="choice_1_1_2_0" id="label_1_1_2_0[]">Yes</label>
</div>';
$new_input .= '</div>';
return $new_input;
}
when validating (on submit) or moving between pages, the chosen selection values are lost and some field values appear on other fields. i believe this is coming from the checkboxes field created by the filter. perhaps because they dont have a unique id once duplicated by the row-add functionality.
Any ideas how to make it work ?
Thanks