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 the form with one link title?

  1. fernando
    Member

    Hello,

    Sorry if this a basic question but can't find any answer.

    I need my visitors to choose products Link 1, Link 2 or Link 3, (these are variations of a product) and when they click the chosen link they go straight to the form.

    In my form, I have a text field called "your chosen product" and I need this automatically populated with the Link Title they previously clicked (hope it makes sense!).

    How can I retrieve this into the form?

    Much appreciated!

    Posted 9 years ago on Friday July 20, 2012 | Permalink
  2. David Peralty

    In your link, add a query string. Eg example.com/form/?product=item1

    In your form, change your field under advanced to allow populate dynamically and give it a parameter of product. Then it should work for you.

    Posted 9 years ago on Friday July 20, 2012 | Permalink
  3. fernando
    Member

    Cheers David, it works.

    Right now I have "mysite.com/?product=500 Business Cards at 22 Euros", so my visitors see what they're buying (at bottom of the form), but the URL is a mess.

    Is there a way to put that information somewhat "hidden", so the URL gets cleaner?

    Thank you.

    Posted 9 years ago on Friday July 20, 2012 | Permalink
  4. David Peralty

    Yes but it would require php coding and theme editing to make possible. Are you comfortable with php?

    Posted 9 years ago on Friday July 20, 2012 | Permalink
  5. fernando
    Member

    Cheers David,

    Not that good, but I can my way around it through testing, and testing... and more testing :) If there is a way to make this "cleaner", I am all for it.

    Posted 9 years ago on Friday July 20, 2012 | Permalink
  6. David Peralty

    You could use the gform_pre_render hook and instead of having your query string be long like that, you could have smaller ones that are translated into longer entities as the form is loading...

    So something like
    mysite.com/?product=912

    If product = 912 then field1 = "Cool Product"

    Then in the gform_pre_render hook, you would either have a list of what those codes meant and then assign the value to the form field or you would put the values in a database and look it up in your table and push the returned value into your form field.

    http://www.gravityhelp.com/documentation/page/Gform_pre_render

    Posted 9 years ago on Friday July 20, 2012 | Permalink