<p>You need to add <code>sectionId</code> to your form:</p>
<pre><code>{{ hiddenInput('sectionId', xx) }}
</code></pre>
<p>If you have multiple entry types, you can also add <code>typeId</code> to the form:</p>
<pre><code>{{ hiddenInput('typeId', xx) }}
</code></pre>
<p>For both examples, replace <code>xx</code> with an actual value, of course :)</p>

CC BY-SA 4.0
2022-12-01T12:04:35.360Z
I did have that in initially but the craft example says to switch 'sectionId' for the id of the section you're posting to. So I changed it to 'blog' but got the error code. Am I supposed to leave  {{ hiddenInput('sectionId', '2') }} untouched and specify the blog somewhere else?
George Bleasdale
CC BY-SA 4.0
2022-12-01T12:33:39.850Z
You need to change `2` to your actual section id. You can find that by going to **Settings → Sections**, click your section then look at the number in your address bar. Alternatively, you'll find this in your database's `sections` table.
Oli
CC BY-SA 4.0
2022-12-02T06:10:23.843Z
That was what I was missing, thank you!!
George Bleasdale
CC BY-SA 4.0
2022-12-01T10:59:30.050Z
2022-12-01T10:59:30.050Z
Oli
<p>I'm pretty new to craft and creating my first front end entry form using the demo code provided by craft. For some reason I'm getting a 'Request missing required body param' error. I've tried adding  but that didn't solve the issue.</p>
<p>Here's my code:</p>
<pre><code>{% extends &quot;_layout.twig&quot; %}

{% macro errorList(errors) %}
  {% if errors %}
    {{ ul(errors, {class: 'errors'}) }}
  {% endif %}
{% endmacro %}

{# If there were any validation errors, an `entry` variable will be 
   passed to the template, which contains the posted values 
   and validation errors. If that’s not set, we’ll default 
   to a new entry. #}
{% set entry = entry ?? create('craft\\elements\\Entry') %}

{# Add `enctype=&quot;multipart/form-data&quot;` to `&lt;form&gt;` if you’re 
   uploading files. #}
&lt;form method=&quot;post&quot; accept-charset=&quot;UTF-8&quot; enctype=&quot;multipart/form-data&quot;&gt;
  {{ csrfInput() }}
  {{ actionInput('entries/save-entry') }}
  {{ redirectInput('viewentry/{slug}') }}
  {{ hiddenInput('friends', '2') }}

&lt;input type=&quot;hidden&quot; name=&quot;entryId&quot; value=&quot;&quot;&gt;

&lt;div class=&quot;mb-6&quot;&gt;
  &lt;label for=&quot;title&quot; class=&quot;block mb-2 text-sm font-medium text-gray-900 dark:text-white&quot;&gt;Your Dog's Name&lt;/label&gt;
  {{ input('text', 'title', entry.title, {
    id: 'title',
    class:'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500',
  }) }}
  {{ _self.errorList(entry.getErrors('title')) }}
&lt;/div&gt;
  
&lt;div class=&quot;mb-6&quot;&gt;
&lt;label for=&quot;featureImage&quot; class=&quot;block mb-2 text-sm font-medium text-gray-900 dark:text-white&quot;&gt;Feature Image&lt;/label&gt;

  {{ input('file', 'featureImage', entry.featureImage, {
    id: 'featureImage',
  }) }}
  {{ _self.errorList(entry.getErrors('featureImage')) }}
&lt;/div&gt;

&lt;div class=&quot;mb-6&quot;&gt;
  &lt;label for=&quot;postContent&quot; class=&quot;block mb-2 text-sm font-medium text-gray-900 dark:text-white&quot;&gt;Tell us about your dog&lt;/label&gt;
  {{ tag('textarea', {
    id: 'postContent',
    name: 'fields[postContent]',
    class:'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500',
  }) }}
  {{ _self.errorList(entry.getErrors('postContent')) }}
&lt;/div&gt;


&lt;div class=&quot;mb-8&quot;&gt;
&lt;label for=&quot;postCategories&quot; class=&quot;block mb-2 text-sm font-medium text-gray-900 dark:text-white&quot;&gt;Breed&lt;/label&gt;
&lt;select name=&quot;fields[postCategories]&quot; id=&quot;postCategories&quot;&gt;
    {# Create a category query with the 'group' parameter #}
{% set myCategoryQuery = craft.categories()
  .group('blog') %}
{# Fetch the categories #}
{% set categories = myCategoryQuery.all() %}
  {# display post categories #}
  {% if entry.postCategories|length %}
  &lt;div class=&quot;border-t py-2 mb-6&quot;&gt;
    {% for category in entry.postCategories.all() %}
      &lt;a href=&quot;{{ category.url }}&quot; class=&quot;inline-block border rounded px-2 py-1 text-sm&quot;&gt;
        {{- category.title -}}
      &lt;/a&gt;
    {% endfor %}
  &lt;/div&gt;
  {% endif %}
  {% nav category in categories %}
    &lt;li&gt;
      &lt;option&gt;{{ category.title }}&lt;/option&gt;
    &lt;/li&gt;
  {% endnav %}  
&lt;/select&gt;
&lt;/div&gt;
{#
{% set field = craft.app.fields.getFieldByHandle('postCategories') %}

{{ hiddenInput('fields[postCategories]', '') }}

&lt;select multiple name=&quot;fields[postCategories][]&quot;&gt;
  {% for option in field.options %}
      {% set selected = entry is defined
        ? entry.postCategories.contains(option.value)
        : option.default %}

      &lt;option value=&quot;{{ option.value }}&quot;
        {% if selected %} selected{% endif %}
      &gt;
        {{ option.label }}
      &lt;/option&gt;
  {% endfor %}
&lt;/select&gt;
#}
&lt;div class=&quot;mb-6&quot;&gt;
  &lt;button type=&quot;submit&quot; class=&quot;text-white bg-blue-700 hover:bg-blue-800 focus:ring-4 focus:outline-none focus:ring-blue-300 font-medium rounded-lg text-sm w-full sm:w-auto px-5 py-2.5 text-center dark:bg-blue-600 dark:hover:bg-blue-700 dark:focus:ring-blue-800&quot;&gt;Publish&lt;/button&gt;
&lt;/div&gt;
&lt;/form&gt;

{% endblock %}
</code></pre>

<frontend-form><params><entry-form>
'Request missing required body param' when submitting front end entry form - Craft CMS
# 'Request missing required body param' when submitting front end entry form - Craft CMS

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

I'm pretty new to craft and creating my first front end entry form using the demo code provided by craft. For some reason I'm getting a 'Request missing required body param' error. I've tried adding  but that didn't solve the issue.
Here's my code:
{% extends "_layout.twig" %}

{% macro errorList(errors) %}
  {% if errors %}
    {{ ul(errors, {class: 'errors'}) }}
  {% endif %}
{% endmacro %}

{# If there were any validation errors, an `entry` variable will be 
   passed to the template, which contains the posted values 
   and validation errors. If that’s not set, we’ll default 
   to a new entry. #}
{% set entry = entry ?? create('craft\\elements\\Entry') %}

{# Add `enctype="multipart/form-data"` to `` if you’re 
   uploading files. #}

  {{ csrfInput() }}
  {{ actionInput('entries/save-entry') }}
  {{ redirectInput('viewentry/{slug}') }}
  {{ hiddenInput('friends', '2') }}




  Your Dog's Name
  {{ input('text', 'title', entry.title, {
    id: 'title',
    class:'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500',
  }) }}
  {{ _self.errorList(entry.getErrors('title')) }}

  

Feature Image

  {{ input('file', 'featureImage', entry.featureImage, {
    id: 'featureImage',
  }) }}
  {{ _self.errorList(entry.getErrors('featureImage')) }}



  Tell us about your dog
  {{ tag('textarea', {
    id: 'postContent',
    name: 'fields[postContent]',
    class:'bg-gray-50 border border-gray-300 text-gray-900 text-sm rounded-lg focus:ring-blue-500 focus:border-blue-500 block w-full p-2.5 dark:bg-gray-700 dark:border-gray-600 dark:placeholder-gray-400 dark:text-white dark:focus:ring-blue-500 dark:focus:border-blue-500',
  }) }}
  {{ _self.errorList(entry.getErrors('postContent')) }}




Breed

    {# Create a category query with the 'group' parameter #}
{% set myCategoryQuery = craft.categories()
  .group('blog') %}
{# Fetch the categories #}
{% set categories = myCategoryQuery.all() %}
  {# display post categories #}
  {% if entry.postCategories|length %}
  
    {% for category in entry.postCategories.all() %}
      
        {{- category.title -}}
      
    {% endfor %}
  
  {% endif %}
  {% nav category in categories %}
    
      {{ category.title }}
    
  {% endnav %}  


{#
{% set field = craft.app.fields.getFieldByHandle('postCategories') %}

{{ hiddenInput('fields[postCategories]', '') }}


  {% for option in field.options %}
      {% set selected = entry is defined
        ? entry.postCategories.contains(option.value)
        : option.default %}

      
        {{ option.label }}
      
  {% endfor %}

#}

  Publish



{% endblock %}

**Tags:** frontend-form, params, entry-form


---

## 1 answers

### Answer by username_1 on 2022-12-01. Score: 1 | Accepted answer

You need to add sectionId to your form:
{{ hiddenInput('sectionId', xx) }}

If you have multiple entry types, you can also add typeId to the form:
{{ hiddenInput('typeId', xx) }}

For both examples, replace xx with an actual value, of course :)

> **Comments:**
> **username_0**: I did have that in initially but the craft example says to switch 'sectionId' for the id of the section you're posting to. So I changed it to 'blog' but got the error code. Am I supposed to leave  {{ hiddenInput('sectionId', '2') }} untouched and specify the blog somewhere else?  
> **username_1**: You need to change `2` to your actual section id. You can find that by going to **Settings → Sections**, click your section then look at the number in your address bar. Alternatively, you'll find this in your database's `sections` table.  
> **username_0**: That was what I was missing, thank you!!  

---

