<p>If you are using custom templates, a good test would be to switch back to using the default templates and confirm that the redirect is working as expected. The default templates can be useful for troubleshooting as they give you a baseline to test against.</p>
<p>Make sure your custom templates include <a href="https://github.com/barrelstrength/craft-sprout-forms/blob/4633099251b7a72e333b7f7a38729c2c8596042c/src/templates/_components/formtemplates/accessible/form.twig#L40-L47" rel="nofollow noreferrer">the Twig code that handles the hidden field for the redirect</a>.</p>
<p>You can see the full template at the link above for additional context:</p>
<pre><code>{%- if redirectUri is not empty %}
    {% if redirectUri|slice(0, 1)|lower == '?' %}
        {%- set redirectUri = craft.app.request.getUrl()~redirectUri %}
    {% endif %}

    &lt;input type=&quot;hidden&quot; aria-hidden=&quot;true&quot; name=&quot;redirect&quot;
        value=&quot;{{ redirectUri|hash }}&quot;&gt;
{% endif %}
</code></pre>

CC BY-SA 4.0
2022-11-30T15:33:16.053Z
2022-11-30T15:33:16.053Z
Ben Parizek
<p>It appears you are using double curly braces for your redirect value where the setting only supports single curly braces for that value. You can find <a href="https://sprout.barrelstrengthdesign.com/docs/forms/forms.html#redirects" rel="nofollow noreferrer">examples of the acceptable values in the docs</a> and I'll post them here too:</p>
<ul>
<li>/thank-you</li>
<li>thank-you</li>
<li>?message=success</li>
<li>thank-you?message=success</li>
<li>{siteUrl}</li>
<li><a href="https://website.com/thank-you" rel="nofollow noreferrer">https://website.com/thank-you</a></li>
</ul>

CC BY-SA 4.0
2022-11-28T14:52:23.533Z
Thank you. I changed `{{SiteUrl}}` to `{SiteUrl}`, but the issue is not fixed. As I wrote, the redirect URL is not contained in the page's source.
Kota.M
CC BY-SA 4.0
2022-11-29T01:18:11.413Z
Are you using custom templates? If so, a good test would be to switch back to using the default templates and confirm that the redirect is working as expected. I've tested the most recent version locally and redirects are working for me. The default templates output the redirect in the source here: https://github.com/barrelstrength/craft-sprout-forms/blob/4633099251b7a72e333b7f7a38729c2c8596042c/src/templates/_components/formtemplates/accessible/form.twig#L40-L47
Ben Parizek
CC BY-SA 4.0
2022-11-29T14:57:16.023Z
Yes, actually the template is a custom one. And the part of rendering redirect input was commented out. Now the form does the redirect to the specified URL. Thank you.
Kota.M
CC BY-SA 4.0
2022-11-30T15:33:52.683Z
Great. I've posted my comment as a separate answer for anybody else that may find themselves here.
Ben Parizek
CC BY-SA 4.0
2022-11-28T14:36:19.677Z
2022-11-28T14:36:19.677Z
Ben Parizek
<p>I would like to set redirect URL on my forms with Sprout Forms plugin, but none of those ways work as I expect. Once I submit the form, it goes to the same page. How can I set a redirect?</p>
<p><strong>1) Insert the redirect URL into &quot;Redirect Page&quot; field in the settings</strong></p>
<p><a href="https://i.sstatic.net/eXHeW.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/eXHeW.png" alt="enter image description here" /></a></p>
<p>The URL is not contained in the form, in HTML.</p>
<p><strong>2) Put a tag of {{redirectInput}} with customHTML field</strong></p>
<p>The tag is not converted to HTML <code>&lt;input&gt;</code>.</p>
<p><strong>3) Put an  tag with customHTML field</strong></p>
<p>The input's <code>name</code> is automatically converted to <code>fields[redirect]</code>.</p>
<p>(2) and (3) above are from this documentation; <a href="https://sprout.barrelstrengthdesign.com/docs/forms/thank-you-page.html" rel="nofollow noreferrer">https://sprout.barrelstrengthdesign.com/docs/forms/thank-you-page.html</a></p>
<p>In addition, there are multiple forms, so I cannot write the redirect URL directly in template.</p>
<p>My Craft CMS is ver 3.7.57, and Sprout Forms plugin is ver 3.13.8.</p>

<plugin-sproutforms>
Sprout Form redirect does not work
# Sprout Form redirect does not work

(Asked by: username_0 on 2022-11-24)

I would like to set redirect URL on my forms with Sprout Forms plugin, but none of those ways work as I expect. Once I submit the form, it goes to the same page. How can I set a redirect?

**1) Insert the redirect URL into "Redirect Page" field in the settings**

[![enter image description here](https://i.sstatic.net/eXHeW.png)](https://i.sstatic.net/eXHeW.png)

The URL is not contained in the form, in HTML.

**2) Put a tag of {{redirectInput}} with customHTML field**

The tag is not converted to HTML .

**3) Put an tag with customHTML field**

The input's `name` is automatically converted to `fields[redirect]`.

(2) and (3) above are from this documentation; <https://sprout.barrelstrengthdesign.com/docs/forms/thank-you-page.html>

In addition, there are multiple forms, so I cannot write the redirect URL directly in template.

My Craft CMS is ver 3.7.57, and Sprout Forms plugin is ver 3.13.8.

**Tags:** plugin-sproutforms


---

## 2 answers

### Answer by username_1 on 2022-11-30. Score: 2 | Accepted answer

If you are using custom templates, a good test would be to switch back to using the default templates and confirm that the redirect is working as expected. The default templates can be useful for troubleshooting as they give you a baseline to test against.
Make sure your custom templates include the Twig code that handles the hidden field for the redirect.
You can see the full template at the link above for additional context:
{%- if redirectUri is not empty %}
    {% if redirectUri|slice(0, 1)|lower == '?' %}
        {%- set redirectUri = craft.app.request.getUrl()~redirectUri %}
    {% endif %}

    
{% endif %}


---

### Answer by username_1 on 2022-11-28. Score: 1

It appears you are using double curly braces for your redirect value where the setting only supports single curly braces for that value. You can find [examples of the acceptable values in the docs](https://sprout.barrelstrengthdesign.com/docs/forms/forms.html#redirects) and I'll post them here too:

* /thank-you
* thank-you
* ?message=success
* thank-you?message=success
* {siteUrl}
* <https://website.com/thank-you>

> **Comments:**
> **username_0**: Thank you. I changed `{{SiteUrl}}` to `{SiteUrl}`, but the issue is not fixed. As I wrote, the redirect URL is not contained in the page's source.  
> **username_1**: Are you using custom templates? If so, a good test would be to switch back to using the default templates and confirm that the redirect is working as expected. I've tested the most recent version locally and redirects are working for me. The default templates output the redirect in the source here: https://github.com/barrelstrength/craft-sprout-forms/blob/4633099251b7a72e333b7f7a38729c2c8596042c/src/templates/_components/formtemplates/accessible/form.twig#L40-L47  
> **username_0**: Yes, actually the template is a custom one. And the part of rendering redirect input was commented out. Now the form does the redirect to the specified URL. Thank you.  
> **username_1**: Great. I've posted my comment as a separate answer for anybody else that may find themselves here.  

---

