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 pass an URL with an Ampersand (&) in a dynamically populated field?

  1. walt
    Member

    Hi

    Currently I'm working on a form with several fields that will be dynamically populated. One of these fields will receive URL's of the following form:

    http://ancestry.org/genealogy/getperson.php?personID=I5843&tree=ancestors

    There is an & in the URL that is currently being cut-off in the dynamically populated field, resulting in:

    http://ancestry.org/genealogy/getperson.php?personID=I5843

    Question: how can I prevent the & from being cut off in the dynamically populated URL field?

    Thanks,
    Walt

    Posted 11 years ago on Tuesday January 1, 2013 | Permalink
  2. I'm not sure if Gravity Forms can do anything about that. If your form is located on a page here:

    http://example.com/form-page/

    And you are sending your string to the form with a parameter like this:

    http://example.com/form-page/?url=http://ancestry.org/genealogy/getperson.php?personID=I5843&tree=ancestors

    I believe WordPress is going to split that into at least two parameters:
    url: http://ancestry.org/genealogy/getperson.php?personID=I5843
    tree: ancestors

    I'm surprised that personID is not split off as well, since there are two question marks in that query string.

    I think this is all coming from WordPress though, and the web server software. Maybe you will need to plan on that "tree" parameter being sent always, and store that in another field, dynamically populated with the parameter name of "tree". If you need to put it all back together, you can do that in a hidden field and use the gform_pre_submission_filter. http://www.gravityhelp.com/documentation/page/Gform_pre_submission_filter

    Or, maybe you can modify the string before it's sent to your form, to encode the ampersand, or otherwise make this appear as just one long string to your WordPress page.

    Posted 11 years ago on Wednesday January 2, 2013 | Permalink