cms
cms copied to clipboard
“Add category” - button selectable (not hidden) when branch limit has been met
Description
The “add a category” button is displayed when it should be disabled (or ideally hidden) when the “branch limit” is set to “1” and a category has already been selected.
Steps to reproduce
- Create a category field, point to your category source and set the branch limit to 1
- Create a new section and add the new category field
- Create a new entry in the section
- Select a category
- The “add a category” button is still selectable (should be hidden) as the branch limit has been met.
The behaviour should mimic the “add asset” button which is hidden when the number of selected images matches the limit set for the field.
Additional info
- Craft version: RC9
- PHP version: 7.0.27
- Database driver & version: MySQL 5.7.21
This isn’t quite the same, but related to #1847 - so should be fixed alongside it.
Just adding that I was confused by this today, too, after setting a limit of 1 on a category field and seeing the button still enabled after 1 category was chosen. Happy to see a solution's underway.
This is still happening in verison raft CMS 3.1.0-beta.7
No work has been done on it yet. I’m going to try to fix it in 3.2.
Any chance this is going to make it into 3.2 ?
I also find this to be a usability issue.
After a category is selected the "add a category" button continues to be shown. Clicking it now opens up the category list again and I can select another category but it doesn't do anything. So it is potentially confusing because the UI implies that (a) I can legitimately select more than one category on this field and (b) that the functionality to add a second category is broken.
I encountered this today while trying to set up re-orderable categories in a matrix for a client. I thought I had done something wrong, and my googling led me here.
I'm glad to see this and #1847 are somewhere in the todo list.
Agreed on the usability front here, the button not hiding like it does for limited entry/asset selectors is causing some confusion with a couple of clients and cluttering our CMS interface up a bit. Hopefully, this gets in soon.
@brandonkelly I know you mentioned this will be fixed in Craft 4, but is there a chance you guys could have a look at it earlier than that?
I agree with the above, the experience is lacking when that button is still clickable etc. Would be very much appreciated.
Thank you
@brandonkelly
You may have noticed the above problem, but I encountered another question. I set the "Branch Limit = 1", I got the following error when saving entry.
- ArgumentCountError
- Too few arguments to function craft\services\Structures::applyBranchLimitToElements(), 1 passed in /app/craft3/vendor/craftcms/cms/src/services/Categories.php on line 733 and exactly 2 expected
Additional info Craft CMS: 3.6.0.1 PHP version: 7.4.16 OS version: Linux 5.4.0-66-generic Database driver & version: MySQL 8.0.25
@Owen-Guo That was fixed in 3.6.1.
@brandonkelly Is there an update on this? When the "branchLimit" is set to "1" the user can still select multiple as well as when one is already defined the "Add a category" button is still shown.
No update yet, sorry, but will give it some attention soon, since the same Branch Limit setting is coming to Entries fields in Craft 4.4.
@brandonkelly Is there an update on this? When the "branchLimit" is set to "1" the user can still select multiple as well as when one is already defined the "Add a category" button is still shown.
@brandonkelly any update for this in Craft 3?
We’ve spent some time on a couple ideas, but it’s a little complicated so nothing fully implemented yet.