We want the user only select one tag from the tags widget, how to config that?
thx
Solved! Go to Solution.
Views
Replies
Total Likes
Well I think in this case, what you would do is just to see if there is any tags added at all and the just pick the first one from the array:
String[] tags = this.properties.get(TAGS_PROPERTY_NAME, new String[0]); String tag= ""; if(tags.length == 0){ //no tags have been added ! }else{ tag = tags[0]; } //Do something nice with your tag
Views
Replies
Total Likes
Well I think in this case, what you would do is just to see if there is any tags added at all and the just pick the first one from the array:
String[] tags = this.properties.get(TAGS_PROPERTY_NAME, new String[0]); String tag= ""; if(tags.length == 0){ //no tags have been added ! }else{ tag = tags[0]; } //Do something nice with your tag
Views
Replies
Total Likes
Thx, this works. But what if I want to save the single tag as string in crx property, not as string[]? Is that possible?
Views
Replies
Total Likes
There is an option/property in the tagInputField that allow you to choose how many tags to accept from a given namespace called "maximum". Set this one to "1" in your case. This has been somewhat explained in this blogpost:
http://cqsearchpromote.blogspot.se/2013/02/how-to-make-tag-input-field-accept.html
/Johan
Views
Replies
Total Likes
Views
Likes
Replies
Views
Likes
Replies