<p>The form code in the template was wrapped in a <code>{% cache %}</code> tag. </p>

CC BY-SA 3.0
2016-06-09T13:53:48.583Z
2016-06-09T13:53:48.583Z
Adam Menczykowski
<p>I have a form created by Sprout Forms, which results in an error when submitted:</p>

<p>The CSRF token could not be verified!</p>

<p>Here is the log:</p>

<pre><code>2016/06/09 11:06:17 [error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'The CSRF token could not be verified.' in /home/forge/www.fira.co.uk/craft/app/services/HttpRequestService.php:1314
Stack trace:
#0 /home/forge/www.fira.co.uk/craft/app/framework/base/CComponent.php(561): Craft\HttpRequestService-&gt;validateCsrfToken(Object(CEvent))
#1 /home/forge/www.fira.co.uk/craft/app/framework/base/CApplication.php(212): CComponent-&gt;raiseEvent('onBeginRequest', Object(CEvent))
#2 /home/forge/www.fira.co.uk/craft/app/framework/base/CApplication.php(183): CApplication-&gt;onBeginRequest(Object(CEvent))
#3 /home/forge/www.fira.co.uk/craft/app/index.php(62): CApplication-&gt;run()
#4 /home/forge/www.fira.co.uk/public/index.php(19): require_once('/home/forge/www...')
#5 {main}
REQUEST_URI=/publications/industry-statistics
HTTP_REFERER=http://www.fira.co.uk/publications/industry-statistics
</code></pre>

CC BY-SA 3.0
2016-06-09T13:48:50.700Z
Which version of Sprout Forms are you using?  Can you update your question to give an example of how are you outputting the form on your page (displayForm tag vs. custom, etc.)?  Also, is it possible you have a {% cache %} tag wrapped around your form?  A CSRF token needs to be unique for each submission.
Ben Parizek
CC BY-SA 3.0
2016-06-09T13:53:03.487Z
Ben, you're a star, you made me realise that the form (which uses the basic function to output the form to a page) was indeed wrapped in a cache tag.
Adam Menczykowski
<plugin-sproutforms>
Sprout Form submit: The CSRF token could not be verified!
# Sprout Form submit: The CSRF token could not be verified!

(Asked by: username_0 on 2016-06-09)

I have a form created by Sprout Forms, which results in an error when submitted:
The CSRF token could not be verified!
Here is the log:
2016/06/09 11:06:17 [error] [exception.Craft\HttpException.400] exception 'Craft\HttpException' with message 'The CSRF token could not be verified.' in /home/forge/www.fira.co.uk/craft/app/services/HttpRequestService.php:1314
Stack trace:
#0 /home/forge/www.fira.co.uk/craft/app/framework/base/CComponent.php(561): Craft\HttpRequestService->validateCsrfToken(Object(CEvent))
#1 /home/forge/www.fira.co.uk/craft/app/framework/base/CApplication.php(212): CComponent->raiseEvent('onBeginRequest', Object(CEvent))
#2 /home/forge/www.fira.co.uk/craft/app/framework/base/CApplication.php(183): CApplication->onBeginRequest(Object(CEvent))
#3 /home/forge/www.fira.co.uk/craft/app/index.php(62): CApplication->run()
#4 /home/forge/www.fira.co.uk/public/index.php(19): require_once('/home/forge/www...')
#5 {main}
REQUEST_URI=/publications/industry-statistics
HTTP_REFERER=http://www.fira.co.uk/publications/industry-statistics

**Tags:** plugin-sproutforms
> **Comments:**
> **username_1**: Which version of Sprout Forms are you using?  Can you update your question to give an example of how are you outputting the form on your page (displayForm tag vs. custom, etc.)?  Also, is it possible you have a {% cache %} tag wrapped around your form?  A CSRF token needs to be unique for each submission.  
> **username_0**: Ben, you're a star, you made me realise that the form (which uses the basic function to output the form to a page) was indeed wrapped in a cache tag.  

---

## 1 answers

### Answer by username_0 on 2016-06-09. Score: 2

The form code in the template was wrapped in a `{% cache %}` tag.


---

