Advertisement
chrishajer

Copy custom field values to a hidden name field

Dec 26th, 2012
154
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 0.61 KB | None | 0 0
  1. <?php
  2. // http://www.gravityhelp.com/forums/topic/inactive-column-options-do-not-include-custom-field#post-108400
  3. // Change 243 here to your form ID
  4. add_action('gform_pre_submission_filter_243', 'populate_name');
  5. function populate_name($form) {
  6.     // hidden name field ID 2 holds the name.  2_3 is first name, and 2_6 is the last name
  7.     // custom fields are accessed as an array of values.  Field 1 is the custom field.
  8.     // item 2 of the zero based array holds the first name: $_POST['input_1'][1]
  9.     $_POST['input_2_3'] = $_POST['input_1'][1];
  10.     $_POST['input_2_6'] = $_POST['input_1'][3];
  11.     return $form;
  12. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement