PLEASE NOTE: These forums are no longer utilized and are provided as an archive for informational purposes only. All support issues will be handled via email using our support ticket system. For more detailed information on this change, please see this blog post.

Inactive Column options do not include custom field

  1. I am working around the Name field limitation which cannot include a Middle Initial by creating a Custom Field. The Custom Field is set as a List with 5 columns: Prefix, First, Middle initial, Last, Suffix. This field, however, does not appear as a column heading option in Inactive Columns so that the name data can be displayed as form entry data. This is vital.

    This problem could be solved in a number of ways - please advise:
    1 - Modify the original Name field to include Middle Initial (seems like this is not an option, but desperately needed)
    2- Pass the Custom Field data to pre-populate a hidden Name field which could be used as a column heading in the Entries admin (can't figure out how to do this - I tried like heck, both shortcodes and PHP)
    3- Include the Custom Field values for First and Last atop the columns in the Entries display. (values not available to drag into Active).

    Thanks - Steve

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  2. Hi Steve. #2 is probably the easiest. You can use the gform_pre_submission filter to copy the value from one field to another.

    Can you show us what code you have already tried?

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  3. Thanks. Still not sure how to hook the values from the Custom Field into the First Name/LastName fields of a standard Name field. The Custom Field has an assigned name "fullname". How do I query list items 2 and 4 (first name/lastname) and then dynamically populate a standard Name field? My previous code attempts have been deleted, but I don't think I was even close. I think I could put together a PHP solution if I knew how to hook what I wanted.

    My guess is that the answer is in the line:

    $_POST["input_14"] = "new value for field 14";

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  4. If the name field in your form is field 20, then first name is '20.3' and last name is '20.6'. You can concatenate them in your PHP function like this:

    // this would apply to form 5
    // change the 5 to your form ID
    add_action("gform_pre_submission_5", "add_name");
    function add_name($form) {
      // there is a space between the two names in " "
      // this will populate field 14 with the first
      // and last names from field 20
      $_POST['input_14'] = $_POST['input_20.3'] . " " . $_POST['input_20.6'];

    Does that help?

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  5. Be sure to quote the field numbers if they contain a decimal, like 20.3 or 20.6.

    You list field will be an array. To get the values and field IDs, I would dump the $_POST object in your function (use either var_dump($_POST) or print_r($_POST)) and in that you will see the exact field numbers you need to query.

    If you add a print_r or var_dump to your function which is hooked to gform_pre_submission, it will normally be echo'd to the screen. This is just a debugging step, just to get the proper field ID to access your values.

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  6. I created a test form with only two fields: custom field for extended name and the standard Name field. I modified your suggested function and the data does not copy. I wish I knew how you arrived at the field decimals. I don't know how to do a dump to get this information, so I take it that the decimals refer to the Field ID that is generated when the form is created. In this case the extended name has five metaboxes (Prefix, First, MI, Last, Suffix) and has an ID of 1, and the standard Name field is ID 2. I tried the string below in a variety of arrangements (source/destination reversed) with no luck. thx - Steve

    FYI, I am only trying to COPY the name data, not transfer it.

    $_POST['input_1.3'] . $_POST['input_1.6'] = $_POST['input_2.1'] . $_POST['input_2.2'];

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  7. Your last PHP statement there is invalid and will never work. I'm not sure what that statement is trying to say.

    Please export that form as XML and send it attached to an email to and I will help you with the field IDs.

    To dump the values, add


    to the function where you are trying to populate the values. That will dump to the browser (usually) the output of the $_POST object. You might have to view the source of the page after you submit the form to see that the $_POST contains. This is just a temporary step to take a look at the object and figure out how to access all the values in the array. If you want to do it on a more permanent basis, we could set it up to log the values, not return them to the screen.

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  8. I imported your form. Here is a screenshot of the result of an entry created after adding the code. Screenshot

    Here is the code I used to do that:

    Let me know if that helps you.

    Posted 11 years ago on Wednesday December 26, 2012 | Permalink
  9. Works great! Thank you, Chris. Please mark as RESOLVED.

    Posted 11 years ago on Friday December 28, 2012 | Permalink
  10. Thanks for the update.

    Posted 11 years ago on Saturday December 29, 2012 | Permalink

This topic has been resolved and has been closed to new replies.