Gform pre submission

Description

This action hook is executed after form validation, but before any notifications are sent and the entry is stored. This action can be used to modify the posted values prior to creating the entry.

Usage

Applies to all forms

<?php
add_action("gform_pre_submission", "pre_submission");
?>


Applies to a specific form. In this case, form Id 5

<?php
add_action("gform_pre_submission_5", "pre_submission");
?>

Parameters

$form

(Form Object) The current form.

Examples

This example changes the post variable for field 14;


<?php

add_action("gform_pre_submission", "pre_submission_handler");
function pre_submission_handler($form){
    $_POST["input_14"] = "new value for field 14";
}
?>

Placement

This code should be placed in the functions.php file of your active theme.

Source Code

This action hook is located in form_display.php

Search the Documentation