| Author |
problem in validating text area max length
|
jaimin gohel
Greenhorn
Joined: Jul 30, 2008
Posts: 13
|
|
i have test area in the jsp page for which i have put a java script to validate the max length of it. but the problem is that as soon as cursor id focus on the tedt area it automatically takes some blank char the code of jsp page is (the opening and closing of the HTML tags are recplaced by "&" sign) <td> <textarea name="projDesc" rows="4" cols="50" on key up ="maxlength(this.form.projDesc,100)"><%=oListProjectBean.getDescription()%></textarea><span class="requi3Field">*</span></td> and javascript is function maxlength(field, maxlen) { alert("hello1jaimin"+field.value.length); if (field.value.length > maxlen){ //alert("hello"+field.value.length); field.value = field.value.substring(0, maxlen); } }
|
 |
Jeanne Boyarsky
internet detective
Marshal
Joined: May 26, 2003
Posts: 26152
|
|
Jaimin, Are you filling the field with more than 100 characters from the description? What do you expect to happen in this case?
|
[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
|
 |
jaimin gohel
Greenhorn
Joined: Jul 30, 2008
Posts: 13
|
|
as soon as the cursor focuses on the the description text area it automatically takes 25 to 27 blank char. which is displayed by the alert that i have put on the javascript. what i want is the normal focus on the text area.......
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56162
|
|
Please take the time to choose the correct forum for your posts. This forum is for questions on JSP. For more information, please read this. This post has been moved to a more appropriate forum.
|
[Smart Questions] [JSP FAQ] [Books by Bear] [Bear's FrontMan] [About Bear]
|
 |
Bear Bibeault
Author and ninkuma
Marshal
Joined: Jan 10, 2002
Posts: 56162
|
|
Also, please be sure to use UBB code tags when posting code to the forums. Unformatted code is extremely hard to read and many people that might be able to help you will just move along to posts that are easier to read. Please read this for more information. You can go back and change your post to add code tags by clicking the .
|
 |
 |
|
|
subject: problem in validating text area max length
|
|
|