I am able to generate an array of values that a user has selected from a multi-select checkboxes field with the code below.
Can anyone explain how to generate the input ids associated with the values? These should be in the format 138.1, 138.2, 138.3 etc.
$user_locations_to_work_field_id = 138;
$user_locations_to_work = GFAPI::get_field( 15, $user_locations_to_work_field_id );
// Create a comma separated list of values e.g. Oldham, Salford, Stockport
$user_locations_to_work_value = is_object( $user_locations_to_work ) ? $user_locations_to_work->get_value_export( $entry, $user_locations_to_work_field_id ) : '';
// Create an array from the list of values outputs Array( [0] => Oldham [1] => Salford [2] => Stockport )
$user_locations_to_work_array = explode(',', $user_locations_to_work_value);
I can generate an array of all the input ids from the multi-select checkboxes field with the following code. However what I am looking for is the input ids associated with the values that a user has selected from a multi-select checkboxes field.
$user_locations_to_work_inputs = $user_locations_to_work->inputs;
// GFCommon::log_debug( __METHOD__ . '(): user_locations_to_work_inputs => ' . print_r( $user_locations_to_work_inputs, true ) );
I have looked through the documentation for using the get_value_export method of the field object Entry Object - Gravity Forms Documentation but it only mentions exporting the values and choices not the input ids.
Could the filter ‘gform_get_input_value’ be used to return the input ids?