Primefaces : How to set the max value for a inputTextarea component ?

You can use this function in Javascript :

onkeyup="if(this.value.length>(max value)){this.value=this.value.substring(0,5);alert('(Warning Text)')}"

Example :

<h:inputTextarea value="#{myController.bigtext}"
                 onkeyup="if(this.value.length>500){this.value=this.value.substring(0,5);alert('The maximum value is 500 characters')}"

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s