<p>Your suspicion about the Craft 2 -&gt; 3 migration is dead-on.</p>
<p>Yii changed how <code>action</code> attributes work between versions 1 and 2 (used in Craft 2 and 3, respectively), so you'll need to update <code>contactForm/sendMessage</code> to <code>contact-form/send-message</code>!</p>
<p>A couple more notes for your Craft 3 journey:</p>
<ul>
<li>There are some handy Twig helpers now to simplify these hidden inputs:
<ul>
<li><code>{{ actionInput('my-controller/action-name') }}</code> (<a href="https://craftcms.com/docs/3.x/dev/functions.html#actioninput" rel="nofollow noreferrer">Docs</a>)</li>
<li><code>{{ redirectInput('some-path') }}</code> (<a href="https://craftcms.com/docs/3.x/dev/functions.html#redirectinput" rel="nofollow noreferrer">Docs</a>)</li>
<li><code>{{ hiddenInput('fieldName', myValue) }}</code> (<a href="https://craftcms.com/docs/3.x/dev/functions.html#hiddeninput" rel="nofollow noreferrer">Docs</a>)</li>
</ul>
</li>
<li>CSRF protection should probably be enabled to reduce malicious/spam submissions.</li>
</ul>
<p>Here's the relevant <a href="https://craftcms.com/docs/3.x/upgrade.html#request-params" rel="nofollow noreferrer">upgrade documentation</a>.</p>

CC BY-SA 4.0
2022-01-26T19:04:31.170Z
2022-02-03T18:03:50.590Z
2022-02-03T18:03:50.590Z
August Miller
<p>I'm getting the following error and stack trace when submitting a form on a CraftCMS-3.7 website...</p>
<pre><code>HTTP 404 – Not Found – yii\web\NotFoundHttpException
Page not found.
↵
Caused by: Invalid Route – yii\base\InvalidRouteException
Unable to resolve the request &quot;contactForm/sendMessage&quot;.
...
</code></pre>
<ul>
<li></li>
</ul>
<pre><code>1. in [redacted]/vendor/craftcms/cms/src/web/Application.phpat line 600
591592593594595596597598599600601602603604605606607608609            $route = implode('/', $request-&gt;getActionSegments());

        try {
            Craft::debug(&quot;Route requested: '$route'&quot;, __METHOD__);
            $this-&gt;requestedRoute = $route;
            return $this-&gt;runAction($route, $_GET);
        } catch (\Throwable $e) {
            $this-&gt;_unregisterDebugModule();
            if ($e instanceof InvalidRouteException) {
                throw new NotFoundHttpException(Craft::t('yii', 'Page not found.'), $e-&gt;getCode(), $e);
            }
            throw $e;
        }
    }

    return null;
}

2. in [redacted]/vendor/craftcms/cms/src/web/Application.php at line 266– craft\web\Application::_processActionRequest(craft\web\Request)
260261262263264265266267268269270271272                    throw new ForbiddenHttpException();
            }
        }
    }

    // If this is an action request, call the controller
    if (($response = $this-&gt;_processActionRequest($request)) !== null) {
        return $response;
    }

    // If we're still here, finally let Yii do it's thing.
    try {
        return parent::handleRequest($request);
3. in [redacted]/vendor/yiisoft/yii2/base/Application.php at line 384– craft\web\Application::handleRequest(craft\web\Request)
4. in [redacted]/web/index.php at line 12– yii\base\Application::run()
6789101112// Load shared bootstrap
require '../bootstrap.php';

// Load and run Craft
/** @var craft\web\Application $app */
$app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php';
$app-&gt;run()
</code></pre>
<p>And the HTML for the form...</p>
<pre><code>&lt;form id=&quot;contact-form&quot; method=&quot;post&quot; action=&quot;&quot; accept-charset=&quot;UTF-8&quot;&gt;
        &lt;h3&gt;Schedule a Demo?&lt;/h3&gt;

        &lt;input id=&quot;vona&quot; name=&quot;vona&quot; type=&quot;text&quot; style=&quot;display:none;&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;action&quot; value=&quot;contactForm/sendMessage&quot;&gt;
        &lt;input type=&quot;hidden&quot; name=&quot;redirect&quot; value=&quot;/thank-you&quot;&gt;

        &lt;label for=&quot;name&quot;&gt;Name&lt;/label&gt;
        &lt;input id=&quot;name&quot; placeholder=&quot;Name&quot; class=&quot;required&quot; type=&quot;text&quot; name=&quot;Name&quot; value=&quot;&quot;&gt;

        &lt;label for=&quot;title&quot;&gt;Company / Job Title&lt;/label&gt;
        &lt;input id=&quot;title&quot; name=&quot;Company&quot; placeholder=&quot;Company&quot; class=&quot;required&quot; type=&quot;text&quot;&gt;

        &lt;label for=&quot;email&quot;&gt;Email Address&lt;/label&gt;
        &lt;input id=&quot;email&quot; placeholder=&quot;Email Address&quot; class=&quot;required&quot; type=&quot;text&quot; name=&quot;Email&quot; value=&quot;&quot;&gt;
        &lt;input id=&quot;hidden-email&quot; name=&quot;Email&quot; type=&quot;text&quot; style=&quot;display:none;&quot; autocomplete=&quot;off&quot; /&gt;

        &lt;textarea id=&quot;message&quot; class=&quot;required&quot; name=&quot;Message&quot; placeholder=&quot;Message&quot; id=&quot;&quot; cols=&quot;30&quot; rows=&quot;10&quot;&gt;&lt;/textarea&gt;
        &lt;input type=&quot;submit&quot; value=&quot;Submit&quot; id=&quot;formSubmitBtn&quot; /&gt;
    &lt;/form&gt;
</code></pre>
<p>I thought that maybe I had the wrong value for the action input, but the same 'Unable to resolve the request &quot;contactForm/sendMessage&quot;' error message is returned regardless of what is listed as its value.</p>

CC BY-SA 4.0
2022-01-26T18:12:35.973Z
It might be helpful to know that this site was migrated from 2.x to 3.x then moved to a different host at one point.  The original live site doesn't have this same problem, but I can't find any errors or warnings that would indicate a problem with the migrated site.
soupmagnet
<plugin-contactform>
Unable to resolve the request "contactForm/sendMessage"
# Unable to resolve the request "contactForm/sendMessage"

(Asked by: username_0 on 2022-01-26)

I'm getting the following error and stack trace when submitting a form on a CraftCMS-3.7 website...
HTTP 404 – Not Found – yii\web\NotFoundHttpException
Page not found.
↵
Caused by: Invalid Route – yii\base\InvalidRouteException
Unable to resolve the request "contactForm/sendMessage".
...




1. in [redacted]/vendor/craftcms/cms/src/web/Application.phpat line 600
591592593594595596597598599600601602603604605606607608609            $route = implode('/', $request->getActionSegments());

        try {
            Craft::debug("Route requested: '$route'", __METHOD__);
            $this->requestedRoute = $route;
            return $this->runAction($route, $_GET);
        } catch (\Throwable $e) {
            $this->_unregisterDebugModule();
            if ($e instanceof InvalidRouteException) {
                throw new NotFoundHttpException(Craft::t('yii', 'Page not found.'), $e->getCode(), $e);
            }
            throw $e;
        }
    }

    return null;
}

2. in [redacted]/vendor/craftcms/cms/src/web/Application.php at line 266– craft\web\Application::_processActionRequest(craft\web\Request)
260261262263264265266267268269270271272                    throw new ForbiddenHttpException();
            }
        }
    }

    // If this is an action request, call the controller
    if (($response = $this->_processActionRequest($request)) !== null) {
        return $response;
    }

    // If we're still here, finally let Yii do it's thing.
    try {
        return parent::handleRequest($request);
3. in [redacted]/vendor/yiisoft/yii2/base/Application.php at line 384– craft\web\Application::handleRequest(craft\web\Request)
4. in [redacted]/web/index.php at line 12– yii\base\Application::run()
6789101112// Load shared bootstrap
require '../bootstrap.php';

// Load and run Craft
/** @var craft\web\Application $app */
$app = require CRAFT_VENDOR_PATH . '/craftcms/cms/bootstrap/web.php';
$app->run()

And the HTML for the form...

        Schedule a Demo?

        
        
        

        Name
        

        Company / Job Title
        

        Email Address
        
        

        
        
    

I thought that maybe I had the wrong value for the action input, but the same 'Unable to resolve the request "contactForm/sendMessage"' error message is returned regardless of what is listed as its value.

**Tags:** plugin-contactform
> **Comments:**
> **username_0**: It might be helpful to know that this site was migrated from 2.x to 3.x then moved to a different host at one point.  The original live site doesn't have this same problem, but I can't find any errors or warnings that would indicate a problem with the migrated site.  

---

## 1 answers

### Answer by username_1 on 2022-01-26. Score: 3

Your suspicion about the Craft 2 -> 3 migration is dead-on.

Yii changed how `action` attributes work between versions 1 and 2 (used in Craft 2 and 3, respectively), so you'll need to update `contactForm/sendMessage` to `contact-form/send-message`!

A couple more notes for your Craft 3 journey:

* There are some handy Twig helpers now to simplify these hidden inputs:
  + `{{ actionInput('my-controller/action-name') }}` ([Docs](https://craftcms.com/docs/3.x/dev/functions.html#actioninput))
  + `{{ redirectInput('some-path') }}` ([Docs](https://craftcms.com/docs/3.x/dev/functions.html#redirectinput))
  + `{{ hiddenInput('fieldName', myValue) }}` ([Docs](https://craftcms.com/docs/3.x/dev/functions.html#hiddeninput))
* CSRF protection should probably be enabled to reduce malicious/spam submissions.

Here's the relevant [upgrade documentation](https://craftcms.com/docs/3.x/upgrade.html#request-params).


---

