I have a Structure section fruit
with a single entry type fruit
.
I also have a Category fruitType
with 2 levels:
- Citrus
- Orange
- Lemon
- Lime
- Melons
- Watermelon
- Honeydew
The entry type fruit
has a Category field for fruitType
.
If I select a level 2 category for the fruitType
field, say Orange
:
Craft CMS dismisses the category selection pop-up and the parent category is shown instead, in this case Citrus
.
From the browser's network inspector, I noticed that a POST request to /admin/actions/elements/getCategoriesInputHtml
with the following form data:
categoryIds[]:893
locale:en_us
id:fields-fruitCategory
name:fields[fruitCategory]
limit:1
selectionLabel:Category
However, the response from the server is:
{"html":"<input type=\"hidden\" name=\"fields[fruitCategory]\" value=\"\">\n\n<div id=\"fields-fruitCategory\" class=\"categoriesfield\">\n\t<ul class=\"elements structure\">\n\t\t\t\t\t<li id=\"fields-fruitCategory-category-887\">\n\t\t\t\t\t\t\t\t<div class=\"row\" style=\"margin-left: -0px; padding-left: 0px;\"><div class=\"element removable\" data-id=\"887\" data-locale=\"en_us\" data-status=\"enabled\" data-label=\"Faculty\" data-url=\"http:\/\/craft.local\/fruit\/citrus\" data-level=\"1\" data-editable><input type=\"hidden\" name=\"fields[fruitCategory][]\" value=\"887\"><a class=\"delete icon\" title=\"Remove\"><\/a> <div class=\"label\"><span class=\"status enabled\"><\/span><span class=\"title\">Citrus<\/span><\/div><\/div><\/div>\n\n\t\t\t\t\t\t\t<\/li>\n\t\t\t<\/ul>\n\n\t<div class=\"btn add icon dashed\">Category<\/div>\n<\/div>\n\n"}
Based on the response and what's rendered in the interface, Citrus is shown and not Orange, despite Orange being selected.