Expand my Community achievements bar.

Maxlength Is nor working in RTE for touch UI

Avatar

Level 3

Hi team,

                I wanted to add  max length character for RTE in touch UI but it is not working.

I think this will be achieved by js .

does any one created js for such  type of  validation.

4 Replies

Avatar

Level 3

Hi @Bhuwan_B ,

                            I already tried but it is not working

Avatar

Community Advisor

Hi @savi50

 

Please try this.

 

kkr1234_0-1638183761170.png

 

kkr1234_1-1638183797352.png

 

//rtemaxvalidation.js

 

(function($, window, document) {
    var registry = $(window).adaptTo("foundation-registry");
    registry.register("foundation.validation.validator", {
        selector: "[data-validation=rtemaxlenvalidation]",
        validate: function(el) {
            var element = $(el);
            var maxLen = element.data('maxlength');
            var rteLen = element.text().trim().length;
            if (rteLen > maxLen) {
               return "Exceeded Maximum Limit";
            }
        }
    });
})
($, window, document);

kkr1234_2-1638183928748.png