3

All my forms on sprout form won't use the redirect they get assigned via the Form builder. Whenever a form is succesfully submited it redirects to my homepage instead of my thank-you page.

<form class="form__regular" method="post" accept-charset="UTF-8" id="contact-form">
    {{ getCsrfInput() }}

    <input type="hidden" name="action" value="sprout-forms/entries/save-entry">
    <input type="hidden" name="handle" value="{{ form.handle }}">
    <input type="hidden" name="redirect" value="{{ form.redirectUri }}">
</form>

Even if I write the redirect URL manually it keeps redirecting me to the homepage.

The only way I can get the redirect to work is when I let sprout forms render the fields.

1 Answer 1

2

In Craft 3, Form redirect values must use the hash filter:

<input type="hidden" name="redirect" value="{{ form.redirectUri|hash }}">

It's mentioned in passing in the docs here.

Without that hash filter, you'll get redirected to the home page as you are experiencing.

2
  • The closing of the tag was just a typo yes, putting the hash filter did the trick. Should have checked out the Craft 3 changes docs a bit more. Not the first issue I ran into regarding a change made for Sprout Forms in Craft 2 to 3 Commented Jul 25, 2018 at 9:15
  • Got it. I've removed reference to the typo to as you corrected it in the question too. Just to note it, this isn't a Sprout Forms change, this is a Craft CMS change. In the case forms are not working with Custom HTML, it is a good debugging step to output the form using the displayForm tag like you did. If all works via that method, digging into the underlying HTML templates line by line can help start to reveal what might be different. Commented Jul 30, 2018 at 13:54

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.