I took the example form of the craft CMS Entry Form Documentation page and tried to use it on a test site. However i always get a HttpException after submitting the Frontend Form.

Here's the Stack Trace.

And a Screenshot of the Error page

Here's the code

<form method="post" accept-charset="UTF-8">
  {{ csrfInput() }}
  {{ actionInput('entries/save-entry') }}
  {{ redirectInput('viewentry/{slug}') }}
  {{ hiddenInput('sectionId', entry.sectionId) }}
  {{ hiddenInput('enabled', '1') }}
  {{ hiddenInput('entryId', entry.id) }}

  <label for="title">Title</label>
  <input id="title" type="text" name="title"
      {%- if entry is defined %} value="{{ entry.title }}"{% endif -%}>

  {% if entry is defined %}
      {{ _self.errorList(entry.getErrors('title')) }}
  {% endif %}

  <input type="submit" value="Publish">

It's a multi-site with 3 languages. So maybe its related to the languages. But i couldn't find any informations for a frontend form in multi-sites.

  • The user submitting the entry will also need to have the permission necessary to create entries for the section they are posting to. (docs.craftcms.com/v3/dev/examples/entry-form.html), did you already check this? – Romain Poirier Nov 28 '19 at 11:19
  • @RomainPoirier well i only tested it myself and i am the admin so it should work. – creme Nov 28 '19 at 11:25
  • Did you set the enableCsrfProtection setting to true in the config/general.php file? – Romain Poirier Nov 28 '19 at 11:27
  • @RomainPoirieryes CsrfProtection is enabled – creme Nov 28 '19 at 11:48
  • Please double check if you are logged in using a user with required permissions while posting the form, because as seen on your screenshot Craft CMS supposes that you made this action as a guest, not a logged in user. – Romain Poirier Nov 28 '19 at 16:24

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.