Site logo

Archived topic

Smooth Scroll & query strings

3 replies · Started by Teresa on July 15, 2020

Viewing posts 1–4 of 4

This is a totally nitpicky wish, but you guys solve all kinds of crazy problems, soooo…

I want to make it super easy for people to click a button to choose the care plan they want, have the page scroll to the Gravity Forms signup form on the page, and have the option they chose already selected.

Query strings are the only method of preselecting form options that work for this particular use case. But it seems I can have either smooth scroll or a complete page reload. Guessing there's something in the smooth scroll script that conflicts.

I left smooth scroll in place on the buttons in the section I linked to in the provided URL. If you check that out, smooth scroll works but dynamic population doesn't. If I remove the smooth scroll class, the URL + query string + anchor name are loaded in a page refresh that is ugly and kind of disorienting compared to smooth scroll. But, at least people will have their chosen option preselected on the form.

Any way to have it all?

Hi there,

i am not sure how that would be possible, if the Form requires the ?string - it will only get that on page load. Some sort of Ajax/JS would be required. Have you asked Gravity Forms if there is a way to do that ?

No idea why I was thinking I might be able to use a query string without a full URL ¯\_(ツ)_/¯ Yes, it does need JS. Duh.

I think we are going to put the form on a separate page. At least then it'll be clearer what's going on. I hope.

For anyone else who runs across this, Gravity Forms provides a few ways to preselect an option in a form. The URL query string is the only method that actually changes it on the fly.

Thanks, David.

Sounds like a plan :) Thanks for sharing the extra info.

This archived topic is closed to new replies.