I had the same issue, and resolved it by executing a simple javascript upon each keystroke. If the user exceeded the max, the keystroke would be rejected (that is, no more text could be entered without deleting previous text)....

In my JSP...
<html:textarea name="MyForm" property="myProperty" rows="15"
onkeydown="return checkSizeAgainstMax(this, value, 65536)"
style="width:100%"/>


My javascript....
function checkSizeAgainstMax(textArea, str, maxLen) {
   if (str.length >= maxLen) {
       textArea.value = textArea.value.substring(0, maxLen);
   }
}

Mike


Srilatha Salla wrote:

Hi,
Can we restrict the length of textarea with any of the attributes?
I have textarea that should not accept more than 250 characters, so I want to 
know if I can restrict the length with textarea attibutes.

Thanks.

__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com



--------------------------------------------------------------------- To unsubscribe, e-mail: [EMAIL PROTECTED] For additional commands, e-mail: [EMAIL PROTECTED]



Reply via email to