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.

Passing form data to modal window...

  1. Hi,
    I've done this fancybox tutorial and have everything working with the iframe:
    http://www.gravityhelp.com/creating-a-modal-form-with-gravity-forms-and-fancybox/

    I need to figure out how to do one extra thing: I want to pass form data TO the modal window to pre-populate the email field. I know how to do this using the Pass Field Data Via Query String settings when going from one page to another, but can't figure out how to pass that data to a modal window (or pass it to the plainpage.php form and get that to show in the modal window.) Can you give me some advice, or point me in the right direction as to how I should be approaching this problem?
    Thanks!
    Biagio

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  2. You should be able to append your population parameter to the link href for the modal iframe. Here is the URL from the walk-through you shared:

    http://www.yourdomain.com/modal-popup-form-page/

    Here is that same URL with a sample population parameter:

    http://www.yourdomain.com/modal-popup-form-page/?to_email=david@rocketgenius.com

    Assuming you have a field on the form which loads in the modal setup to populate from this parameter, that should do the trick.

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  3. David,
    Thanks so much for the reply. This is still a little over my head, and I'm not sure if I asked the question right, so let me rephrase:
    On my home page, I have a newsletter signup where a person can just enter their email.
    I want that email to pre-populate a form in a modal window, where they then have the option to also add first name and zip code.
    So would I do something like:
    http://www.yourdomain.com/modal-popup-form-page/?to_email={Email:1}
    Thanks,
    Biagio

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  4. Can you provide a link to your site so I can see how you have this set up?

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  5. Sorry David, it's on a MAMP local server at the moment, and in rough shape. I will get it on a sandbox tonight. In the mean time, I put together these screenshots just in case they help clear things up.

    1. Here's the front page:
    http://jokeandbiagio.com/images/01frontPage.tiff
    2. Right now, entering the email and hitting submit...
    http://jokeandbiagio.com/images/02formFilledIn.tiff
    3. Passes it to another form as expected.
    http://jokeandbiagio.com/images/03emailPassesIn.tiff
    4. But I'd like instead to pass it so that the form pops up in a modal window like this, with the email field passed in.
    http://jokeandbiagio.com/images/04modal.tiff

    Trying to figure out how to pass that to the form and launch the modal window with the iframe to that form showing the passed in data.
    Thanks,
    Biagio

    Posted 12 years ago on Monday May 16, 2011 | Permalink
  6. Hi Biaggo,

    There are a couple steps to setting this up.

    1. On the form that you will be loading into the modal window, make sure you set the whichever field you want to populate the email into is set up to allow dynamic population and has 'email' as the parameter: http://img.ounceofdev.com/a9Ah
    2. Now we need a link that will trigger that modal window. The following snippet will add a hidden link AND the javascript necessary to append the email value from the launch form to the URL that will be used to populate the iframe opened in the modal window. This means it will take a URL like:

      http://localhost/about-2/

      ...and update it with the email value like so:

      http://localhost/about-2/?email=david@rocketgenius.com

    3. You will see several spots that require you to customize the code based on IDs and values specific to your setup.

      let me know if you have any questions.

    Posted 12 years ago on Tuesday May 17, 2011 | Permalink