0

I'm using Gravity Forms on my WP site and when a specific link is clicked, I want the page to scroll down to the contact form where a corresponding field will have been dynamically populated.

I have the dynamic population part working, but my problem is that the project in question is one of those long, one page sites… so when the link is clicked the page reloads and brings the user back up to the top, which is quite confusing. If at this point you scroll down to the form you can see the field has been populated correctly, but I'm looking for a way to do this without making the page reload (ajax?) so they are just anchored down to the now populated form.

form embedded in template:

<?php gravity_form(1, false, false, false, '', true); ?>

link to form:

<a href="?message=Testing message">contact us</a>
pixeloco
  • 255
  • 3
  • 16
  • What if you linked directly to that segment of the page using a hash, as described here: http://stackoverflow.com/questions/2835140/how-do-i-link-to-part-of-a-page-hash – redleaf Mar 25 '14 at 18:57
  • thanks for the suggestion but I didn't have any luck going that route (the div's id is "contact") `contact us` has no effect when clicked, while `contact us` does successfully dynamically populate the field but the anchor has no effect/the page is reloaded and scrolled to the top :/ – pixeloco Mar 26 '14 at 00:12

1 Answers1

1

The order in which the URL parameters are written matters. This structure won't work:

#contact?message=Testing message

But with the ID at the end it should:

?message=Testing message#contact

This post is what lead me to figure this out: Correct way to pass multiple values for same parameter name in GET request

Jake
  • 370
  • 4
  • 15