• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Limit the length of textarea in struts.

 
Varsha Patil
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Does anyone know how to set the maxlength for a textarea. I have a requirement where in the User should not be allowed to enter more than 1000 characters in a textarea.

I tried setting maxlength=1000, but then its not working.

Thanks in advance
 
dongfang wang
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
It seems not able to set this property,

also in HTML tag "textarea"
 
Merrill Higginson
Ranch Hand
Posts: 4864
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I don't believe you can set a maximum length on a text area. One possible work-around would be to use JavaScript to check the size of the data in the text area when the fom is submitted and then issue an error message if it exceeds 1000.
 
Bear Bibeault
Author and ninkuma
Marshal
Pie
Posts: 64617
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"Varsha G A",

There aren't many rules that you need to worry about here on the Ranch, but one that we take very seriously regards the use of proper names. Please take a look at the JavaRanch Naming Policy and adjust your display name to match it.

In particular, your display name must be a first and a last name separated by a space character, and must not be obviously fictitious.

Thanks!
bear
JavaRanch Sheriff
 
Varsha Patil
Greenhorn
Posts: 19
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I have changed the display name as per the naming policy.

Thanks,
Varsha
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic