Im trying to setup a front end user form with a category as a select box. The box looks right but when i submit the form i get a new entry and other fields are filled out but the catgory fields are blank?

This is for a fieldgroup named borough and the field on the section is also called bourough

<form method="post" action="" accept-charset="UTF-8">
  <input type="hidden" name="action" value="entries/saveEntry">
  <input type="hidden" name="redirect" value="account/jobs?added={id}">
  <input type="hidden" name="sectionId" value="9">
  <input type="hidden" name="enabled" value="0">

<!-- other form fields -->

  {% set boroughs = craft.categories.group('borough') %}

  <select name="fields[borough]" class="form-control">
       {% for category in boroughs %}
           <option value="{{category.id}}">
       {% endfor %}

So looks like I was just missing the extra [] in the name.


Since categories are arrays the name also needed to be an array!

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.