Capture Querystring value and pass to GF form from WP page

Hi,

Newbie question here. I have a WP page that has a GF form. I want to get the quersytring value and pass into a GF form as a hidden field.

I know how to build this in javascript on HTML, but not sure how to do this with GF.

Thanks

Newbie

Hi Raymon. You can populate fields in a Gravity Forms form with the query string using this approach:

If you have any other questions, please let us know.

Duh… thank you @chrishajer . Looks like it’s built in, I don’t need to do anything special in WP, cause if I have the field names setup in GF, it will automagically populate the values from the querystring.

Sound right?

Yes, if your parameter name matches exactly, and it’s not a reserved term in WordPress, the field will be populated with the value you send, if this is a field that accepts open text, or, if the value matches one of the choice based fields (like a radio button or checkbox.)

For example, test this page:
https://gravityforms.chrishajer.com/query-strings/?FirstName=Chris&LastName=Hajer&Reference_Person=Gravity&Pref=Morning

The parameter names are:

  • FirstName
  • LastName
  • Reference_Person
  • Pref

For FirstName, LastName and Reference_Person, you can send any value, and the field will be populated with that.

For Pref, the value needs to match the choice exactly. For example, morning would not work: it has to be Morning (just as you see on the page.)

If you have any questions about how that works in Gravity Forms, please let us know.

© 2008 - 2021. Gravity Forms is a project by Rocketgenius Inc.