3

I am following the documentation for Craft 2 here to create an entry form on the front end of my website. The form appears correctly on the front end but when I submit it, I get the following error: "Page not found. Caused by: Invalid Route – yii\base\InvalidRouteException Unable to resolve the request: entries/saveEntry"

Here's my form:

<form method="post" accept-charset="UTF-8">
    {{ csrfInput() }}
    <input type="hidden" name="action" value="entries/saveEntry">
    <input type="hidden" name="redirect" value="news/{slug}">
    <input type="hidden" name="sectionId" value="1">

    <label for="title">Title</label>
    <input id="title" type="text" name="title" value="">

    <label for="body">Body</label>
    <textarea id="body" name="fields[body]" rows="20"></textarea>


    <input type="submit" value="Submit">
</form>

Does anyone know where I am going wrong here? The user I am currently using to submit the form is an admin. I realize that the docs I'm following are for Craft 2 but I could not find this form in the Craft 3 docs.

Any help would be appreciated and thanks in advance!

1 Answer 1

8

Craft 3 uses kebab-case paths instead of camelCase paths Your action parameter must be entries/save-entry

Its all stated in the docs

Edit: generally a good idea is to inspect the html in your cp form and copy it to your frontend. You'll be able to solve 90% of your issues that way

2
  • Link is dead... Commented Oct 12, 2021 at 10:15
  • 2
    Thank you - I replaced it with the new one Commented Oct 13, 2021 at 7:04

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.