Highlighted

Maxlength property for richtext - touch UI

angthefire

07-11-2017

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.

Replies

Highlighted

kautuk_sahni

Community Manager

07-11-2017

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.

angthefire

07-11-2017

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