Using Gravity Forms ‘gform_incomplete_submission_post_get’ PHP action

The gform_incomplete_submission_post_get filter allows you to override the draft submission for Save and Continue after it is retrieved from the database but before it is used to populate the form.

Usage

add_filter('gform_incomplete_submission_post_get', 'your_function_name', 10, 3);

Parameters

  • $submission_json (array) – JSON encoded associative array containing the incomplete submission. The following is found in the array:
    • $submitted_values (array) – The submitted values.
    • $partial_entry (array) – The draft entry created from the submitted values.
    • $field_values (null|array) – The dynamic population field values.
    • $page_number (int) – The form’s current page number.
    • $files (array) – The uploaded file properties.
    • $gform_unique_id (string) – The unique ID for this submission.
  • $resume_token (string) – The unique token which can be used to resume the incomplete submission at a later date/time.
  • $form (Form Object) – The form object.

More information

See Gravity Forms Docs: gform_incomplete_submission_post_get

Examples

Modify the user’s first name in the saved data

add_filter('gform_incomplete_submission_post_get', 'modify_incomplete_submission_after', 10, 3);
function modify_incomplete_submission_after($submission_json, $resume_token, $form) {
    // Change the user first name to Test in the saved data
    $updated_json = json_decode($submission_json);
    $updated_json->submitted_values->{'1'}->{'1.3'} = 'Test';
    $submission_json = json_encode($updated_json);
    return $submission_json;
}

Remove an uploaded file from the saved data

add_filter('gform_incomplete_submission_post_get', 'remove_uploaded_file', 10, 3);
function remove_uploaded_file($submission_json, $resume_token, $form) {
    // Remove an uploaded file from the saved data
    $updated_json = json_decode($submission_json);
    unset($updated_json->files->{'2'});
    $submission_json = json_encode($updated_json);
    return $submission_json;
}

Update a submitted value based on another value

add_filter('gform_incomplete_submission_post_get', 'update_submitted_value', 10, 3);
function update_submitted_value($submission_json, $resume_token, $form) {
    // Update the submitted value of field 3 based on the value of field 1
    $updated_json = json_decode($submission_json);
    if ($updated_json->submitted_values->{'1'} == 'Yes') {
        $updated_json->submitted_values->{'3'} = 'Updated';
    }
    $submission_json = json_encode($updated_json);
    return $submission_json;
}

Clear a specific field value

add_filter('gform_incomplete_submission_post_get', 'clear_specific_field_value', 10, 3);
function clear_specific_field_value($submission_json, $resume_token, $form) {
    // Clear the value of field 4 in the saved data
    $updated_json = json_decode($submission_json);
    $updated_json->submitted_values->{'4'} = '';
    $submission_json = json_encode($updated_json);
    return $submission_json;
}