Is is possible to assign a category via a frontend Guest Entry form.

I tried

<input type="hidden" name="fieldHandle" value="SomeExistingCategorySlug">

But that did not work.

1 Answer 1


Simply put, a Categories field is an array containing category ids, and your form needs to send it that way:

<input type="hidden" name="fields[fieldHandle][]" value="100">

Adding brackets to your field-handle submits the value as an array, and 100 is the id of the category.

  • Where do I find the category id? Commented Aug 11, 2014 at 17:50
  • You can either output it in your template: {{ craft.categories.group('group_handle').slug('some_slug').first.id }}, or go to "Backend -> Categories" inspect a category, and look for the data-id attribute.
    – Victor
    Commented Aug 11, 2014 at 18:03
  • I had tried using the data-id before I asked. Sorry, should have specified. Form sends, all data is recorded, just not the category. Commented Aug 11, 2014 at 18:10
  • Try creating a plugin with a guestEntries.beforeSave-event and dump-die all the data, to check if it gets send correctly.
    – Victor
    Commented Aug 11, 2014 at 18:33
  • Replaced name="fieldHandle[]" with name="fields[fieldHandle][]" and Victor's solution worked. Commented Aug 13, 2014 at 13:27

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.