How to restrict number of tags we are able to select in the component dialog | Community
Skip to main content
Level 9
June 6, 2016
Solved

How to restrict number of tags we are able to select in the component dialog

  • June 6, 2016
  • 13 replies
  • 7136 views

Hi All,

In our component dialog.xml, we currently have the below :

<tags
                    jcr:primaryType="cq:Widget"
                    cls="cq-propsdialog-tags"
                    fieldLabel="Tags"
                    name="./cq:tags"
                    xtype="tags"/>

#1] We should be able to restrict the tags we are able to select in the dialog to 3. Saw a similar article https://forums.adobe.com/thread/1175413, but on trying that , it doesn't seem to be working correctly.

#2] Also, an additional query : what should be done if we have to restrict 3 tags per namespace.

if you can let me know the changes that have to be made to the dialog structure/reference articles, it would be helpful.

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

Hi All, 

Tried writing a listener making use of addtag() event in Tagfield, but it is failing in all scenarios except one. Basically, is of no use in real world-scenarios.

Any snippet/reference would be helpful.

13 replies

kautuk_sahni
Community Manager
Community Manager
June 13, 2016

Hi

The internal team has said that you need to write a custom validator to do the needful.

Reference article shared are:-

Link 1:- http://experience-aem.blogspot.in/2016/06/aem-62-touch-ui-validator-for-restricting-tag-count-dialog-field.html [Touch UI]

Link 2:- http://experience-aem.blogspot.in/2016/06/aem-61-classic-ui-limit-number-of-tags-selected-xtype-tags-widget.html [Classic UI]

I hope this would help you.

 

Thanks and Regards

Kautuk Sahni

Kautuk Sahni
askdctmAuthor
Level 9
June 13, 2016

Hi Kautuk,

Phewwww. At last able to get it to work. Thanks a ton :)

kautuk_sahni
Community Manager
Community Manager
June 13, 2016

askdctm wrote...

Hi Kautuk,

Phewwww. At last able to get it to work. Thanks a ton :)

 

Excellent!!

Please share a solution with small code for communities benefit.

 

Thanks and Regards

Kautuk Sahni  

Kautuk Sahni