Skip to main content
vjleo94
Level 3
February 8, 2022

Restrict tag field to max 2 tags TouchUI

I have a dialog field of following resource type 

sling:resourceType="cq/gui/components/coral/common/form/tagfield".

 

I would like to allow authors to select maximum of two tags. How to achieve this ? 

This post is no longer active and is closed to new replies. Need help? Start a new post to ask your question.

4 replies

JeevanRaj
Community Advisor
Community Advisor
February 8, 2022

Hi @vjleo94 

 

This blogpost might help. Have not tried this out myself.

 

http://experience-aem.blogspot.com/2016/06/aem-62-touch-ui-validator-for-restricting-tag-count-dialog-field.html

 

Thanks,

Translate
vjleo94
vjleo94Author
Level 3
February 8, 2022

@jeevanraj I saw this as well. But this is being done on a tagpicker. Not on a "cq/gui/components/coral/common/form/tagfield"

Translate
Mani_kumar_
Community Advisor
Community Advisor
February 8, 2022

We can implement custom validators.

Please check below example for validators.

https://medium.com/@ramamity94/easily-achieving-dialog-validations-in-aem-touch-ui-e78106012282

 

Translate
vjleo94
vjleo94Author
Level 3
February 9, 2022

Thanks @mani_kumar_ , I will try it out!

Translate