Form Return URL Help

I have a client who has a paid version of hubspot and they want to embed a hubspot form on a WordPress website … I need the return URL to be the same URL where the request came from along with a custom query added at the end of it … like ?success .. is there a way to set the http referrer as the return url? if so what’s the code to place in the return URL section?
We will have multiple pages with this form and so all the return urls need to simply return back to the page url with ?success added at the end
Can anyone advise if this is even possible?
the reason for this query string url is because we want to hide content on the page and show it only after the form has been submitted …i got all that stuff figured out but just need the return url to work as mentioned above.
thanks for any assistance and guidance!
Elyssa

Heyo @elyssa1

Have you looked the redirectUrl Attribute on referenced on this page?

Curious to know how it works out. @piersg probably has better ideas than me, though. He always does :sad_but_relieved_face:

Thanks @dennisedson .. that all looks like klingon to me lol …

I wouldn’t even know where to add any code or how to write the code.

No time like the present to learn klingon :upside_down_face:

Presently, how are you adding your forms to the Wordpress site?

Hi @elyssa1, if I understand you correctly, after submitting the form you want the user to be redirected back to the same page they submitted form on, but with they query parameter ‘?success’ at the end of it? e.g. if they submit form on /landing-page you want them to be redirected to /landing-page?success. If that’s correct, this embed code should work:

<!--[if lte IE 8]>
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2-legacy.js"></script>
<![endif]-->
<script charset="utf-8" type="text/javascript" src="//js.hsforms.net/forms/v2.js"></script>
<script>
hbspt.forms.create({
 portalId: '[THEIR PORTAL ID]',
 formId: '[THE FORM ID]',
 onFormSubmitted: function() {
 window.location = window.location.href + '?success'
 }
});
</script>