Expand my Community achievements bar.

RTE Max no of Chars.

Avatar

Level 4

I have 2 rte feilds where 

1.description has 300 max char

2. item list which is a  multifeild rte has 230 max char. 

I have multiple scenarios 

1.So when I set those limits by writing custom validation  , for description it is working fine where as for list items it is showing the limit alert but not displaying the content. 

2. if i check max char for description  and list items it gives an alert when exceeded and when go back to description to check again, list items max char length alert is showing up and vice versa.

3 list item is not displaying the content if max char limit is not checked. if its checked it is displaying more than required chars

 

 

 

(function($, Granite) {
    "use strict";
$(document).on("click", ".cq-dialog-submit", function (e) {
       
 
        if($("[name='./description']").val().replace(/(<([^>]+)>)/ig,"").length > 300){
$(window).adaptTo("foundation-ui").alert("Please Enter Description Characters less than or equal to 300");
     return false;
        }
        
        
        var checkCharacterCount = true;
        $("[name='./itemValue']").each(function () {
            var $this = $(this);
            if($this.val().replace(/(<([^>]+)>)/ig,"").length > 200){
$(window).adaptTo("foundation-ui").alert("Please Enter List Items values Characters less than or equal to 200");
checkCharacterCount = false;
return false;
            }
        });
        if(!checkCharacterCount){
         return false;
        }
    });
 
})(Granite.$, Granite)
2 Replies

Avatar

Level 10

Hi Vijay,

We will try to work on this use case and let you know once it got worked!!

Also, Could you show your dialog screenshot, how you build it?

Thanks,
Ratna.