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.

single line text insert address variable

  1. gchinola
    Member

    I created a custom taxonomy called Location (nonhierarchical). The Gravity Forms + Custom Post type plugin lets set a single line text field where any user inputs would add to that taxonomy.

    What I want to do is have the text field hidden and pass the City value from an address field into the single line text field.

    I tried setting the default value to the {Address (City):1.3} variable but the field came back empty.

    Can this be done another way?

    Posted 12 years ago on Friday December 9, 2011 | Permalink
  2. Hi, gchinola,

    If you just want to update the hidden field on your form with the value of another field, you can use the hook "gform_pre_submission". The documentation for this hook can be found at http://www.gravityhelp.com/documentation/page/Gform_pre_submission .

    Posted 12 years ago on Tuesday December 13, 2011 | Permalink
  3. gchinola
    Member

    I added this to my functions.php and it's still coming back blank:

    add_action("gform_pre_submission_3", "pre_submission_handler");
    function pre_submission_handler($form){
        $_POST["input_18"] = $_POST["input_1.3"];
    }

    where field 18 is the hidden text field and 1.3 is the city part of the address field.

    Edit:
    I went over some other related posts. I should have had "input_1_3". It's working now. Thank you for the help.

    Posted 12 years ago on Tuesday December 13, 2011 | Permalink
  4. Glad you got it working. Have fun!

    Posted 12 years ago on Wednesday December 14, 2011 | Permalink

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