Restrict tag picker field for leaf tags only (tags that doesn't have children) | Community
Skip to main content
January 23, 2025
Solved

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

  • January 23, 2025
  • 2 replies
  • 806 views

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

Best answer by Jozsef_MartonVa

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

2 replies

TarunKumar
Community Advisor
Community Advisor
January 23, 2025

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

January 23, 2025

Hello @tarunkumar 

Thanks for the help.

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

Jozsef_MartonVaAuthorAccepted solution
January 31, 2025

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
SreenivasBr
Level 4
January 23, 2025

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