<p>I'm sort of stumped in troubleshooting the following problem that I'm having with the Contact Form. Below I'll list the code, some of the attributes of the code that may be causing this issue, and the steps I've taken to solve this problem so far. This is actually my first time building out a contact form, so mostly, I'm looking to see if anybody has a method or process for troubleshooting errors like this that appear sort of vague.</p>
<p><strong>Application Info</strong></p>
<ul>
<li>PHP version  7.4.3 OS version</li>
<li>Linux 5.4.0-65-generic</li>
<li>Database driver &amp;    version  MySQL 8.0.23</li>
<li>Image driver &amp; version   GD 7.4.3</li>
<li>Craft edition &amp; version  Craft Solo 3.6.7</li>
<li>Yii version  2.0.40</li>
<li>Twig version v2.14.3</li>
<li>Guzzle version   6.5.5</li>
</ul>
<p>The template is built using Bootstrap</p>
<p><strong>Here is the code:</strong>
(ctrl+F: div class=&quot;col-md-9 mb-md-0 mb-5&quot; to find the div container that holds the twig code)</p>
<pre><code>    {% extends &quot;_layout&quot; %}
{% block stylesheets %}
    &lt;link href=&quot;css/contact.css&quot; type=&quot;text/css&quot; rel=&quot;stylesheet&quot; /&gt;
{% endblock %}

{% block main %}

&lt;div class=&quot;container&quot;&gt;
    &lt;section class=&quot;row&quot;&gt;
      &lt;div class=&quot;container&quot;&gt;
        &lt;section class=&quot;mb-4 py-5&quot;&gt;
            &lt;!--Section heading--&gt;
            &lt;h2 style=&quot;color: #367F97; text-align: start;&quot; class=&quot;h1-responsive font-weight-bold text-center my-4&quot;&gt;{{entry.contactHeading}}&lt;/h2&gt;
            &lt;!--Section description--&gt;
            &lt;p class=&quot;w-responsive mx-auto mb-5&quot;&gt;Leave your name, email, and inquiry below and a representative will be in touch with you shortly. In the meantime, you may view our &lt;b&gt;&lt;a style=&quot;color:#367F97;&quot; href=&quot;{{ siteUrl  ~ 'faq' }}&quot;&gt;F.A.Q.&lt;/a&gt;&lt;/b&gt; for related questions.&lt;/p&gt;
  
            &lt;div class=&quot;row&quot;&gt;
  
                &lt;!--Grid column--&gt;
                &lt;div class=&quot;col-md-9 mb-md-0 mb-5&quot;&gt;
                    {% macro errorList(errors) %}
                    {% if errors %}
                        &lt;ul class=&quot;errors&quot;&gt;
                            {% for error in errors %}
                                &lt;li&gt;{{ error }}&lt;/li&gt;
                            {% endfor %}
                        &lt;/ul&gt;
                    {% endif %}
                    {% endmacro %}

                    {% from _self import errorList %}
                    
                    &lt;form id=&quot;contact-form&quot; name=&quot;contact-form&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&gt;
                        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contact-form/send&quot;&gt;
                        {% nocache %}
                            {{ csrfInput() }}
                        {% endnocache %}
                        &lt;!--Grid row--&gt;
                        &lt;div class=&quot;row&quot;&gt;
  
                            &lt;!--Grid column--&gt;
                            &lt;div class=&quot;col-md-6&quot;&gt;
                                &lt;div class=&quot;md-form mb-0&quot;&gt;
                                    &lt;input id=&quot;from-name&quot; type=&quot;text&quot; name=&quot;fromName&quot; value=&quot;{{ message.fromName ?? '' }}&quot; minlength=&quot;2&quot; placeholder=&quot;Full Name&quot; class=&quot;form-control&quot; style=&quot;border-width:0; background-color:#DFDFDF; border-radius:76px;&quot; required&gt;
                                    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}
                                &lt;/div&gt;
                            &lt;/div&gt;
                            &lt;!--Grid column--&gt;
  
                            &lt;!--Grid column--&gt;
                            &lt;div class=&quot;col-md-6&quot;&gt;
                                &lt;div class=&quot;md-form mb-0&quot;&gt;
                                    &lt;input id=&quot;from-email&quot; type=&quot;email&quot; name=&quot;fromEmail&quot; value=&quot;{{ message.fromEmail ?? '' }}&quot; class=&quot;form-control&quot; placeholder=&quot;Email&quot; style=&quot;border-width:0; background-color:#DFDFDF; border-radius:76px;&quot; required&gt;
                                    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
                                &lt;/div&gt;
                            &lt;/div&gt;
                            &lt;!--Grid column--&gt;
  
                        &lt;/div&gt;
                        &lt;!--Grid row--&gt;
  
                        &lt;!--Grid row--&gt;
                        &lt;div class=&quot;row&quot;&gt;
                            &lt;div class=&quot;col-md-12 my-4&quot;&gt;
                                &lt;div class=&quot;md-form mb-0&quot;&gt;
                                    &lt;input id=&quot;subject&quot; type=&quot;text&quot; name=&quot;subject&quot; value=&quot;{{ message.subject ?? '' }}&quot; class=&quot;form-control&quot; placeholder=&quot;Subject&quot; style=&quot;border-width:0; background-color:#DFDFDF; border-radius:76px;&quot; required&gt;
                                    {{ message is defined and message ? errorList(message.getErrors('subject')) }}
                                &lt;/div&gt;
                            &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;!--Grid row--&gt;
  
                        &lt;!--Grid row--&gt;
                        &lt;div class=&quot;row&quot;&gt;
                            &lt;!--Grid column--&gt;
                            &lt;div class=&quot;col-md-12&quot;&gt;
  
                                &lt;div class=&quot;md-form&quot;&gt;
                                    &lt;textarea type=&quot;text&quot; id=&quot;message&quot; name=&quot;message&quot; rows=&quot;2&quot; placeholder=&quot;     Your message...&quot; class=&quot;form-control md-textarea&quot; style=&quot; height: 20rem; border-width:0; background-color:#DFDFDF; border-radius:20px;&quot;&gt;&lt;/textarea&gt;
                                    {{ message is defined and message ? errorList(message.getErrors('message')) }}
                                &lt;/div&gt;
  
                            &lt;/div&gt;
                        &lt;/div&gt;
                        &lt;!--Grid row--&gt;
                        &lt;input class=&quot;btn btn-success py-2 mt-3 d-flex&quot; style=&quot;margin:0 10% 0 90%&quot; type=&quot;submit&quot; value=&quot;Send&quot;&gt;
                        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;recaptcha/recaptcha/verify-submission&quot;&gt;
                        {{ craft.recaptcha.render() }}
                        &lt;div id=&quot;status&quot;&gt;
                            {% if craft.app.session.hasFlash('notice') %}
                                &lt;p class=&quot;message notice&quot;&gt;{{ craft.app.session.getFlash('notice') }}&lt;/p&gt;
                            {% elseif craft.app.session.hasFlash('error') %}
                                &lt;p class=&quot;message error&quot;&gt;{{ craft.app.session.getFlash('error') }}&lt;/p&gt;
                            {% endif %}
                        &lt;/div&gt;
                    &lt;/form&gt;
                &lt;/div&gt;
                &lt;!--Grid column--&gt;
  
                &lt;!--Grid column--&gt;
                &lt;div class=&quot;col-md-3 text-center&quot;&gt;
                    &lt;ul class=&quot;list-unstyled mb-0&quot;&gt;
                        &lt;li&gt;&lt;i class=&quot;fas fa-map-marker-alt fa-2x&quot;&gt;&lt;/i&gt;
                        &lt;p&gt;
                          19800 MacArthur Blvd&lt;br&gt;
                          Suite 300, Office 363&lt;br&gt;
                          Irvine, California 92612, USA&lt;br&gt;
                          Phone: +1 949 724 4577&lt;br&gt;
                          &lt;a href=&quot;&quot; style=&quot;color:#FFF;&quot;&gt;Click here for location map&lt;/a&gt;
                        &lt;/p&gt;
                        &lt;/li&gt;
  
                        &lt;li&gt;&lt;i class=&quot;fa fa-phone mt-4 fa-2x&quot;&gt;&lt;/i&gt;
                            &lt;p&gt;+ 0 123 456 7891&lt;/p&gt;
                        &lt;/li&gt;
  
                        &lt;li&gt;&lt;i class=&quot;fa fa-envelope mt-4 fa-2x&quot;&gt;&lt;/i&gt;
                            &lt;p&gt;support@agoraneos.com&lt;/p&gt;
                        &lt;/li&gt;
                    &lt;/ul&gt;
                &lt;/div&gt;
                &lt;!--Grid column--&gt;
  
            &lt;/div&gt;
        &lt;/section&gt;
    &lt;/div&gt;
    &lt;/section&gt;
&lt;/div&gt;

{% endblock %}

{% block scripts %}
    &lt;script src=&quot;https://www.google.com/recaptcha/api.js&quot;&gt;&lt;/script&gt;
    &lt;script&gt;
        function onSubmit(token) {
          document.getElementById(&quot;#contact-form&quot;).submit();
        }
    &lt;/script&gt;
    &lt;script src=&quot;https://jqueryvalidation.org/files/lib/jquery-1.11.1.js&quot;&gt;&lt;/script&gt;
{% endblock%}
</code></pre>
<p>Using bootstrap, the form appears like so:</p>
<p><a href="https://i.sstatic.net/mQ4J5.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/mQ4J5.png" alt="enter image description here" /></a></p>
<p>However, when I submit a message, the following, fairly vague error is returned:</p>
<p><a href="https://i.sstatic.net/ffjKr.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/ffjKr.png" alt="enter image description here" /></a></p>
<p>To be fully transparent, my conceptual understanding of what a parameter is or where I may need to be looking in my stack is pretty lacking.</p>
<p><strong>Attributes</strong></p>
<p>This twig template was formatted using the documentation from the &quot;Contact Form&quot; plugin available on the Craft CMS store.</p>
<p>In addition to this, I am using the Google reCaptcha v2 plugin &amp; have enabled 'enableCrsfProtection' in config/general.php.</p>
<p>As I was running into this issue, I first decided to remove the page and try simply copy and pasting the code available from the <a href="https://github.com/craftcms/contact-form" rel="nofollow noreferrer">GitHub documentation</a>. This still returned the 400 error.</p>
<p>Next, I figured it may be an issue with how I implemented CRSF protection and found out on StackExchange that this might be fixed by using the No Cache plugin in the twig code to prevent the CRSF tokens from cacheing.</p>
<p>{% nocache %}
{{ crsfInput() }}
{% endnocache %}</p>
<p>This also appears to not work.</p>
<p>If anybody has ran into any similar issues with the contact form plugin or may be able to throw me some clues, please let me know! Thank you!</p>
<p>Update: Still no luck, but removing both the NoCache and ReCaptcha plug-ins gets the page to return &quot;Bad Request: Unable to verify your data request.&quot;</p>
<p><a href="https://i.sstatic.net/cnGVE.png" rel="nofollow noreferrer"><img src="https://i.sstatic.net/cnGVE.png" alt="enter image description here" /></a></p>
<p><strong>Error Log</strong></p>
<pre><code>2021-02-26 11:57:22 [-][-][-][error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in /var/www/mywebsite/vendor/yiisoft/yii2/web/Controller.php:209
Stack trace:
#0 /var/www/mywebsite/vendor/craftcms/cms/src/web/Controller.php(138): yii\web\Controller-&gt;beforeAction()
#1 /var/www/mywebsite/vendor/yiisoft/yii2/base/Controller.php(179): craft\web\Controller-&gt;beforeAction()
#2 /var/www/mywebsite/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller-&gt;runAction()
#3 /var/www/mywebsite/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller-&gt;runAction()
#4 /var/www/mywebsite/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module-&gt;runAction()
#5 /var/www/mywebsite/vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application-&gt;runAction()
#6 /var/www/mywebsite/vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application-&gt;_processActionRequest()
#7 /var/www/mywebsite/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application-&gt;handleRequest()
#8 /var/www/mywebsite/web/index.php(22): yii\base\Application-&gt;run()
#9 {main}
</code></pre>

CC BY-SA 4.0
2021-02-27T01:07:14.373Z
Can you look in your Craft `storage/logs` folder and find the full stack trace leading up to that error and edit the original question to share it?
Brad Bell
CC BY-SA 4.0
2021-02-27T01:44:43.713Z
Sure! Dropping it in my question now, thank you!!
Dylan
CC BY-SA 4.0
2021-03-02T00:01:12.500Z
As a test, can you remove/disable the nocache and Google reCaptcha v2 plugins and see if you see the same behavior?
Brad Bell
CC BY-SA 4.0
2021-03-02T18:57:27.850Z
Doing this returns "Bad Request: Unable to verify your data submission." Just based on what I know, maybe this issue could be with the CRSF token in some way? What do you think?
Dylan
CC BY-SA 4.0
2021-03-02T22:19:23.313Z
It's definitely CSRF related, just wanted to make sure those plugins weren't interfering with it. If it's happening on a public site and you want to send some Craft control panel and SSH/(s)FTP access over to support@craftcms.com, we can dig in a bit further.
Brad Bell
CC BY-SA 4.0
2021-03-03T17:02:59.103Z
Sure thing! Thanks so much for all your help
Dylan
<error-message><plugin-contactform><params><error-handling>
Contact form returning "Error 400: Bad Request: Request missing required param" -- how can I best narrow down the issue?
# Contact form returning "Error 400: Bad Request: Request missing required param" -- how can I best narrow down the issue?

(Asked by: username_0 on 2021-02-26)

I'm sort of stumped in troubleshooting the following problem that I'm having with the Contact Form. Below I'll list the code, some of the attributes of the code that may be causing this issue, and the steps I've taken to solve this problem so far. This is actually my first time building out a contact form, so mostly, I'm looking to see if anybody has a method or process for troubleshooting errors like this that appear sort of vague.
Application Info

PHP version  7.4.3 OS version
Linux 5.4.0-65-generic
Database driver &    version  MySQL 8.0.23
Image driver & version   GD 7.4.3
Craft edition & version  Craft Solo 3.6.7
Yii version  2.0.40
Twig version v2.14.3
Guzzle version   6.5.5

The template is built using Bootstrap
Here is the code:
(ctrl+F: div class="col-md-9 mb-md-0 mb-5" to find the div container that holds the twig code)
    {% extends "_layout" %}
{% block stylesheets %}
    
{% endblock %}

{% block main %}


    
      
        
            
            {{entry.contactHeading}}
            
            Leave your name, email, and inquiry below and a representative will be in touch with you shortly. In the meantime, you may view our F.A.Q. for related questions.
  
            
  
                
                
                    {% macro errorList(errors) %}
                    {% if errors %}
                        
                            {% for error in errors %}
                                {{ error }}
                            {% endfor %}
                        
                    {% endif %}
                    {% endmacro %}

                    {% from _self import errorList %}
                    
                    
                        
                        {% nocache %}
                            {{ csrfInput() }}
                        {% endnocache %}
                        
                        
  
                            
                            
                                
                                    
                                    {{ message is defined and message ? errorList(message.getErrors('fromName')) }}
                                
                            
                            
  
                            
                            
                                
                                    
                                    {{ message is defined and message ? errorList(message.getErrors('fromEmail')) }}
                                
                            
                            
  
                        
                        
  
                        
                        
                            
                                
                                    
                                    {{ message is defined and message ? errorList(message.getErrors('subject')) }}
                                
                            
                        
                        
  
                        
                        
                            
                            
  
                                
                                    
                                    {{ message is defined and message ? errorList(message.getErrors('message')) }}
                                
  
                            
                        
                        
                        
                        
                        {{ craft.recaptcha.render() }}
                        
                            {% if craft.app.session.hasFlash('notice') %}
                                {{ craft.app.session.getFlash('notice') }}
                            {% elseif craft.app.session.hasFlash('error') %}
                                {{ craft.app.session.getFlash('error') }}
                            {% endif %}
                        
                    
                
                
  
                
                
                    
                        
                        
                          19800 MacArthur Blvd
                          Suite 300, Office 363
                          Irvine, California 92612, USA
                          Phone: +1 949 724 4577
                          Click here for location map
                        
                        
  
                        
                            + 0 123 456 7891
                        
  
                        
                            support@agoraneos.com
                        
                    
                
                
  
            
        
    
    


{% endblock %}

{% block scripts %}
    
    
    
{% endblock%}

Using bootstrap, the form appears like so:

However, when I submit a message, the following, fairly vague error is returned:

To be fully transparent, my conceptual understanding of what a parameter is or where I may need to be looking in my stack is pretty lacking.
Attributes
This twig template was formatted using the documentation from the "Contact Form" plugin available on the Craft CMS store.
In addition to this, I am using the Google reCaptcha v2 plugin & have enabled 'enableCrsfProtection' in config/general.php.
As I was running into this issue, I first decided to remove the page and try simply copy and pasting the code available from the GitHub documentation. This still returned the 400 error.
Next, I figured it may be an issue with how I implemented CRSF protection and found out on StackExchange that this might be fixed by using the No Cache plugin in the twig code to prevent the CRSF tokens from cacheing.
{% nocache %}
{{ crsfInput() }}
{% endnocache %}
This also appears to not work.
If anybody has ran into any similar issues with the contact form plugin or may be able to throw me some clues, please let me know! Thank you!
Update: Still no luck, but removing both the NoCache and ReCaptcha plug-ins gets the page to return "Bad Request: Unable to verify your data request."

Error Log
2021-02-26 11:57:22 [-][-][-][error][yii\web\HttpException:400] yii\web\BadRequestHttpException: Unable to verify your data submission. in /var/www/mywebsite/vendor/yiisoft/yii2/web/Controller.php:209
Stack trace:
#0 /var/www/mywebsite/vendor/craftcms/cms/src/web/Controller.php(138): yii\web\Controller->beforeAction()
#1 /var/www/mywebsite/vendor/yiisoft/yii2/base/Controller.php(179): craft\web\Controller->beforeAction()
#2 /var/www/mywebsite/vendor/craftcms/cms/src/web/Controller.php(190): yii\base\Controller->runAction()
#3 /var/www/mywebsite/vendor/yiisoft/yii2/base/Module.php(534): craft\web\Controller->runAction()
#4 /var/www/mywebsite/vendor/craftcms/cms/src/web/Application.php(274): yii\base\Module->runAction()
#5 /var/www/mywebsite/vendor/craftcms/cms/src/web/Application.php(577): craft\web\Application->runAction()
#6 /var/www/mywebsite/vendor/craftcms/cms/src/web/Application.php(253): craft\web\Application->_processActionRequest()
#7 /var/www/mywebsite/vendor/yiisoft/yii2/base/Application.php(392): craft\web\Application->handleRequest()
#8 /var/www/mywebsite/web/index.php(22): yii\base\Application->run()
#9 {main}

**Tags:** error-message, plugin-contactform, params, error-handling

> **Comments:**
> **username_1**: Can you look in your Craft `storage/logs` folder and find the full stack trace leading up to that error and edit the original question to share it?  
> **username_0**: Sure! Dropping it in my question now, thank you!!  
> **username_1**: As a test, can you remove/disable the nocache and Google reCaptcha v2 plugins and see if you see the same behavior?  
> **username_0**: Doing this returns "Bad Request: Unable to verify your data submission." Just based on what I know, maybe this issue could be with the CRSF token in some way? What do you think?  
> **username_1**: It's definitely CSRF related, just wanted to make sure those plugins weren't interfering with it. If it's happening on a public site and you want to send some Craft control panel and SSH/(s)FTP access over to support@craftcms.com, we can dig in a bit further.  
> **username_0**: Sure thing! Thanks so much for all your help  

---

## 0 answers

