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.

how to populate a hidden field with een other field

  1. I am trying to get an emailaddress in a hidden field in the same form using the hook on: http://www.gravityhelp.com/documentation/page/Gform_pre_submission

    what should I be using in the line below when I want to update my hidden field input_14 with another field on my form named E-mailadres and has id 1 ?

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

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  2. Try this:

    [php]
    $_POST['input_14'] = rgpost('input_1');

    That will take the value from input_1 and store it in your hidden field input_14. rgpost is a little safer than using $_POST directly when reading the value. It would work the same in most cases to just do this:

    [php]
    $_POST['input_14'] = $_POST['input_1'];

    (Note the change from parentheses to brackets.)

    If this does not work, please post a link to your form so we can take a look.

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  3. I used the first one, works great. So everytime I want to store an input field in a hidden field I can use this code ? What should I use for other fields like dropdown fields etc, is there some kind of reference ?

    Thanks for your fast help

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  4. Other fields are sometimes more complex. You can try this simple example and see if it works, but if not, you would need to take a look at the $_POST and see what parameters are there to know the exact format of the field you want to read.

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  5. Ok, is it possible to get information from info on the post I am displaying the form on?

    I am displaying different posts in one screen and there is an e-mail field (form) below every post. A user can enter his e-mail address and then receives a link with for the specific post.

    To build the URL I need to get the post title for the selected post.

    Hope this makes sense

    Posted 11 years ago on Thursday October 18, 2012 | Permalink
  6. If these are individual posts in a loop or archive page, you can add a single line text field (make it admin only if you want) and include this merge tag as the default value:

    {embed_post:post_title}

    That will give you the title of the post where the form is embedded.

    Posted 11 years ago on Wednesday October 24, 2012 | Permalink
  7. moltogelato
    Member

    http://suzukiwashington.org/membership/

    I would like the Billing City and State fields to dynamically populate the Studio City and State fields. I don't know what to enter into the Parameter Name to accomplish this.

    Thanks,
    Matthew

    Posted 11 years ago on Sunday March 10, 2013 | Permalink
  8. Sounds like you want to copy the data entered in some fields (billing city and billing state) to two other fields (studio city and studio state.) You can use jQuery to accomplish this. It's not a feature of Gravity Forms. Here is one explanation of how to do it: http://stackoverflow.com/q/10884730

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  9. moltogelato
    Member

    Thanks! I'm new to html so I'll play around with it and see if I can get it to work.

    Posted 11 years ago on Wednesday March 13, 2013 | Permalink
  10. Hi, I'm working on this and it works when my custom field is set to Date and the Date Input Type set to "Date Picker". But, when I try the Date Field option it no longer works.
    Here is the code I used:

    [php]
    add_filter("gform_pre_submission_1", "populate_date");
    function populate_date($form){
    		$_POST['input_11'] = $_POST['input_12'];
    		}

    Date Picker just makes one input field, but Date Field nests 3 inputs like 12_1, 12_2, 12_3

    Is there away to just make it say '$_POST['input_11'] = $_POST['input_12_1', 'input_12_2', 'input_12_3'];' ?
    I would like to use the Date Picker in the first place, but there seems to be a javascript conflict on my site that breaks the pop-out calander :/ So, I've been trying to get the Date Field to work for a while with no luck.

    Posted 11 years ago on Sunday April 7, 2013 | Permalink
  11. If you have an issue with the datepicker script not working, please post a URL to your site so we can take a look for JavaScript errors.

    Posted 11 years ago on Wednesday April 10, 2013 | Permalink