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.

Pass form value to a variable (opposite of pre-populate)

  1. I wish to create a 'search form' where I can pass the selected values from drop-down and multiple choice fields to variables which I can then output like custom post fields. The purpose for this is to build a string which I can then pass to an embedded iframe URL.

    I have created a non-gravity form version of this search form here: http://www.astronautdesigns.com/demo/gravity/form.php

    Essentially I need to have variables such as $agentid, $proptype, etc that I can echo into the template page containing the iframe, so the URL inside the iframe is dynamically updated by the search form.

    I have tried using the custom fields option in the form builder, but I can't get it to update the values of the custom fields on the page to which the form redirects. It is quite likely that I don't know what I'm doing here and also possible that this is not the best approach to this problem.

    I have also read a number of support topics that cover 'pre-populating', but I seem to need to the opposite; populating some variables after the form submission.

    Another thing to note is that unlike data capturing forms, I don't need to store the form entries. It doesn't really bother me if this cannot be disabled.

    I could just implement my demo and that would be OK, but if I can set this up with Gravity then it will be easy for the client to make changes to the search parameters.

    Thanks in advance,
    Tim.

    Posted 12 years ago on Monday June 20, 2011 | Permalink
  2. You could redirect to a URL as your confirmation and pass form field values via the query string to this page. Your page template could then read these querystring values and populate them in the iframe URL where necessary.

    To use the confirmation redirect you would edit your form, edit Form Settings, select the Confirmation Tab and select URL Redirect as the Confirmation. You'd then enter the full HTTP path to the page you want to redirect to and can use the querystring builder below that to build your querystring from form fields.

    Posted 12 years ago on Monday June 20, 2011 | Permalink
  3. I have done what you suggested with great success, with the exception of one element: multiple selections from a checkbox list. I need to be able to pass the selections to the query string as a comma separated list. I may have seen a mention on a different thread that this function is planned for an upcoming release, otherwise is there any other way of doing this? The application for this is to have a user select multiple ZIP codes.

    Posted 12 years ago on Wednesday July 20, 2011 | Permalink
  4. There isn't currently anyway to do this without using the merge tag for each individual checkbox. They are treated as separate fields because they are technically individual inputs, unlike drop downs and radio buttons which are a single input with multiple choices.

    This is a feature we plan on adding to the 1.6 release to allow you to use a merge tag for the entire Checkbox field which would pass the selected values as a comma delimited list. I can see if this is something we can go ahead and knock out quickly so I can send you an updated version. I'll have to discuss it with our lead developer.

    Posted 12 years ago on Wednesday July 20, 2011 | Permalink
  5. Hi Carl,

    Yes please, I would very much like to get my hands on a 1.6 beta if that is possible. I am due to launch my client's site very soon and I'll be happy to test it out for you.

    Here's the page with the multi-select checkbox option: http://174.132.128.98/~gpmnet/search2

    Thanks,
    Tim
    tim@astronautdesigns.com

    Posted 12 years ago on Thursday July 28, 2011 | Permalink
  6. Hi Rocket Geniuses,

    Any chance I can get my hands on the check box merge tag code for passing multiple selections to the query string?

    Yeah, I know I harassing but I have completely finished my project with the exception of this function.

    Tim.

    Posted 12 years ago on Friday August 12, 2011 | Permalink