cms icon indicating copy to clipboard operation
cms copied to clipboard

“Add category” - button selectable (not hidden) when branch limit has been met

Open richhayler opened this issue 7 years ago • 15 comments

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

  1. Create a category field, point to your category source and set the branch limit to 1
  2. Create a new section and add the new category field
  3. Create a new entry in the section
  4. Select a category
  5. 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

richhayler avatar Feb 12 '18 03:02 richhayler

This isn’t quite the same, but related to #1847 - so should be fixed alongside it.

brandonkelly avatar Feb 12 '18 12:02 brandonkelly

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.

heymarkreeves avatar Mar 07 '18 01:03 heymarkreeves

This is still happening in verison raft CMS 3.1.0-beta.7

owldesign avatar Jan 11 '19 01:01 owldesign

No work has been done on it yet. I’m going to try to fix it in 3.2.

brandonkelly avatar Jan 11 '19 10:01 brandonkelly

Any chance this is going to make it into 3.2 ?

richhayler avatar May 06 '19 11:05 richhayler

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.

KarlBishop avatar Feb 15 '21 09:02 KarlBishop

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.

nathansnelgrove avatar Feb 19 '21 22:02 nathansnelgrove

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.

TheFunkyMonk avatar Mar 03 '21 19:03 TheFunkyMonk

@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

clieee avatar Mar 18 '21 22:03 clieee

@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 avatar Jul 20 '21 06:07 Owen-Guo

@Owen-Guo That was fixed in 3.6.1.

brandonkelly avatar Jul 20 '21 18:07 brandonkelly

@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.

stephenmatthews avatar Jan 17 '23 11:01 stephenmatthews

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 avatar Feb 02 '23 22:02 brandonkelly

@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?

AmarHuda1 avatar Jan 26 '24 08:01 AmarHuda1

We’ve spent some time on a couple ideas, but it’s a little complicated so nothing fully implemented yet.

brandonkelly avatar Jan 29 '24 18:01 brandonkelly