Solved

How javascript check input text size in JSP page?

Posted on 2008-10-21
1
1,131 Views
Last Modified: 2008-10-21
I need to validate the text input in jsp page with javascript

If null and length > 20
then alert

the following code does not work
<form name="form1" method="POST" action="register.jsp" onsubmit="return Validation(this);">
 
 

<SCRIPT LANGUAGE="JavaScript">

function Validation()

{

if(this.txtName.value=="" || this.txtName.value.length > 20)

{

alert("Please input your name less than 20 chars");

return false;

}else

{

return true;

}	

}

</SCRIPT>
 

<input type="text" name="txtName" id="txtName" maxlength="20">

Open in new window

0
Comment
Question by:techques
1 Comment
 

Accepted Solution

by:
techques earned 0 total points
ID: 22773379
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Basic JavaScript Question 3 38
CSS Position not returning 2 48
how to add new optional parameter to JSP 1 29
Interview question Javascript, database 12 32
I've been trying to accomplish this for a while and it just struck me yesterday how to accomplish this task. I have done searches all over the internet looking for ways to email pages from my applications and finally I have done it!!! Every single s…
Article by: DanRollins
This article describes a JavaScript program that creates a maze made of hexagonal cells.  In Part 2 (http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/A_7850-Hex-Maze-Part-2.html), we'll extend the program by adding a depth-…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)
The viewer will learn the basics of jQuery including how to code hide show and toggles. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery…

920 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

14 Experts available now in Live!

Get 1:1 Help Now