Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save Garconis/51437b4d7db48aecee5a380808346b73 to your computer and use it in GitHub Desktop.
Save Garconis/51437b4d7db48aecee5a380808346b73 to your computer and use it in GitHub Desktop.
Gravity Forms | Add a hidden field that pulls in value of another field and then prepends or appends additional text to it
<?php
// Change 6 on the following to your form id number.
add_action( 'gform_pre_submission_6', 'pre_submission_handler' );
function pre_submission_handler( $form ) {
// Change 145 to be the Hidden Field id number and 114_6 to the Last Name id number
// which you can get while inspecting the fields in the backend of the Gravity Form while editing it
$_POST['input_145'] = rgpost( 'input_114_6' ) . ' - Household';
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment