Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
Bedrock Mission!

Learn more

View all

Sign in to view all badges

Maxlength Is nor working in RTE for touch UI

savi50
Level 2
Level 2

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.

1 Reply
savi50
Level 2
Level 2

Hi @Bhuwan_B ,

                            I already tried but it is not working

kishorekumar14
Level 10
Level 10

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