I have a frontend form that has a select list for language. This field will allow for one language to be selected. In the backend I have a field set up for my entries as a category field populated by country categories set as required. I can not seem to get the database to update this category field from my frontend form. The select field is set up as follows for the form field handle language.

<select id="language" name="fields[language]">
    <option value="English">English</option>

Anything I am missing to get this to populate correctly.


1 Answer 1


Couple things. First, I believe you need to add an extra set of brackets to the name attribute. The reason being that category fields (as well as all 'related' fieldTypes) store more than one element, even if as in this case there is only one category being assigned. Secondly you'll need to assign the category id as the value.

<select id="language" name="fields[language][]">
    {% for category in craft.categories.group('languages') %}
         <option value="{{ category.id }}">{{ category.title }}</option>
    {% endfor %}
  • no I tried that and it made no difference!
    – Lettie
    May 20, 2015 at 15:43
  • Sorry. Haven't had coffee yet. I wasn't looking at what you were assigning as the value — you'll want to use the category id for this. I updated the answer. May 20, 2015 at 16:13
  • Great! Sorry I missed that the first time. May 20, 2015 at 16:25
  • I always forget that second set of []
    – Mosswalker
    Apr 18, 2022 at 20:09

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.