This week's book giveaway is in the OCMJEA forum.
We're giving away four copies of OCM Java EE 6 Enterprise Architect Exam Guide and have Paul Allen & Joseph Bambara on-line!
See this thread for details.
The moose likes HTML, CSS and JavaScript and the fly likes Maxlength for textarea  not being set properly Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of OCM Java EE 6 Enterprise Architect Exam Guide this week in the OCMJEA forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Maxlength for textarea  not being set properly" Watch "Maxlength for textarea  not being set properly" New topic
Author

Maxlength for textarea not being set properly

K Robert
Ranch Hand

Joined: May 16, 2003
Posts: 116
I have the current function to limit the amount of characters allowed in a text area:



My problem is that if I set it for "150", I get "151". From testing, it looks like it's not recognizing the first character space and starts the count at the #2 space in the text area.

Any thought?
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
You are starting at index 0 and ending at 150. Subtract 1 from the end.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Maxlength for textarea not being set properly