Expand my Community achievements bar.

Don’t miss the AEM Skill Exchange in SF on Nov 14—hear from industry leaders, learn best practices, and enhance your AEM strategy with practical tips.

Maxlength property for richtext - touch UI

Avatar

Level 2

AEM provides the property "maxlength" for textfield in touch UI but it doesn't work for richtext. Is there any property similar to maxlength for richtext which can perform the same functionality.

2 Replies

Avatar

Administrator

The RTE does not support max length and required properties.

Alternatively, you can use allowBlank= false for required and for maxlength you can add a listener (validator) on click of OK button of dialog checking the length of the characters entered in RTE and validate accordingly.

Or

Add a property "validateValue" in your RTE field and add this function as the value, This is working for me. Change the length in if condition according to your need.

function(field){

var temp=this.getValue();

                                if(temp.length>500){

                                                this.markInvalid("Description should not exceed 500 characters");

                                                return false;

                                }else{

                                                this.clearInvalid();

                                                return true;

                                }

}

Note:- RTE in dialog uses the concept of validation from the Form Validation in Granite UI. And, since, Inline-editing does not behave as a form, it can’t use that validation concept.



Kautuk Sahni

Avatar

Level 2

Hi Kautuksahni,

Thanks for the reply.

I tried using the property "validateValue", with type as "String" and value as the function but it doesn't work.

Please find below the screenshot:

1343574_pastedImage_0.png

Am I doing it incorrectly or have I missed something here? Is this solution applicable to touch UI?

Thanks