aspose file tools*
The moose likes Servlets and the fly likes How to restrict length of Text in a JSP Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Servlets
Bookmark "How to restrict length of Text in a JSP" Watch "How to restrict length of Text in a JSP" New topic
Author

How to restrict length of Text in a JSP

Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Hi Guys,
Though it is a HTML question, but I placed this one here as there was nothing indipendent for HTML.
How can I restrict number of Characters user can type in the text boxes. As when I use size= "25" though the box becomes 25 char long but you can write as many chacters in that.

<input type="text" size="25" name=<%=CORP_NAME%> value = "<%=getCmpnyName() %>" ></h6>
Neha
Terence Doyle
Ranch Hand

Joined: May 30, 2001
Posts: 328
Hi Neha,
Use 'maxlength=x' like this:
<input type="text" name="textfield" size="25" maxlength="20">
Bye,

------------------
Terry Doyle
Sun Certified Programmer for Java 2 Platform


Raising Flares debut album 'Ignition' out now

http://www.raisingflares.com

Terry Doyle <br />SCPJ 1.4 , SCWCD , SCMAD(Beta)
Abraham Jacob
Greenhorn

Joined: Oct 16, 2001
Posts: 25
HI Neha,
Try this
<INPUT type="text" name="foo" maxlength="8" size="8">

maxlength determines the size
Neha Sharma
Ranch Hand

Joined: Jul 13, 2001
Posts: 126
Thanks Guys !!
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: How to restrict length of Text in a JSP
 
Similar Threads
Jwebunit
Values after Submit Button pressed
JSP Help Regarding the Radio Button
3 fiels form based login authentication in Tomcat
Storing resultset into arraylist