Skip to main content
New Member
Jan 23, 2025 11:22 AM UTC
Solved

Restrict tag picker field for leaf tags only (tags that doesn't have children)

Hello,

 

We would like to restrict the tag picker field, so when our editors edit the properties of a page, they could only select tags, that does not have any child tag.

For example, there is the "Fruit" tag and under that, you can have "Berries" and under that you can have different kinds of berries like blueberry, cranberry, raspberry etc.

Currently we are able to select the "Fruit" and "Berries" tags, but we would like to disallow this behaviour, and only allow selecting the specific berries.

 

Is this possible? If so, how?

Thank you,

Marci

Jozsef_MartonVaAccepted solution
New Member
Jan 31, 2025 8:32 AM UTC

I ended up adding a custom js to the clientlib, that hides all checkboxes, of variant = "drilldown" on the

foundation-selections-change event
Thanks again

4 replies

TarunKumar
Community Advisor
Community Advisor
Jan 23, 2025 12:42 PM UTC

Hi @jozsef_martonva ,

 

You can try to implement custom jQuery  logic to achieve this. The logic will perform below stesp:

1.  Validation on tags selection.

2. Server call or ajax call to check if selected tag is a child node.

3. Return boolean based on that.

4. Trigger the validation message if its is child tag.

 

Hope it helps!

 

-Tarun

Translate
New Member
Jan 23, 2025 1:22 PM UTC

Hello @tarunkumar 

Thanks for the help.

Can we disable the checkbox on these tags? It would be more desirable from UX point of view.

Translate
Jozsef_MartonVaAuthorAccepted solution
New Member
Jan 31, 2025 8:32 AM UTC

I ended up adding a custom js to the clientlib, that hides all checkboxes, of variant = "drilldown" on the

foundation-selections-change event
Thanks again
Translate
SreenivasBr
Level 4
Jan 23, 2025 6:55 PM UTC

Changing the tags picker functionality is not possible. You can either validate and remove the tags or modify the tags selection on submission of dialog using listeners

Translate