I'd suggest NOT using the multiple category selector. I'd suggest uing the Object Selector. This will allow you to do some custom work in the UI without writing custom code for a form control. You can set the following values in the Advanced section of the control:
- Object type = cms.category
- Return column name = CategoryGUID (suggest using this so they are the same across environments)
- Object site name = #curentsite
- Selection mode = Multiple
- Where condition = CatgegoryName LIKE 'StartOfCodeName.%'(suggest using the code name field and prefix it like a namespace as the category ID and category path can change very easy and are not the same in all environments.
- Order by CategoryDisplayName
This should allow you to get what you want. Keep in mind how you structure your category tree will make a difference, kind of. We use it for organizational structure but base all our look ups on the code name and how we prefix them. For example, the following is a list of News categories with the first value being the display name and the second value being the code name.
- News, main.news
-- General, news.general
-- Technology, news.technology
--- Computer Games, news.technology.computergames
--- Computer Programming, news.technology.computerprogramming
-- Lifestyle, news.lifestyle
--- Outdoors, news.lifestyle.outdoors
--- Travel, news.lifestyle.travel
---- Local, news.lifestyle.travel.local
---- International, news.lifestyle.travel.international
So in the above example, if I wanted to get all the Lifestyle categories, I'd change my WhereCondition
to `CatgegoryName LIKE 'news.lifestyle.%' and it would return the following (in a nested format):
--- Outdoors, news.lifestyle.outdoors
--- Travel, news.lifestyle.travel
---- Local, news.lifestyle.travel.local
---- International, news.lifestyle.travel.international
There are may ways to do this but we've found this to be the most robust way to keep categories from breaking and allow users to enter their new categories without causing a things to break or additional dev time.