File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes JSF and the fly likes please help me How to make InputText field not get more than specified value Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Android Security Essentials Live Lessons this week in the Android forum!
JavaRanch » Java Forums » Java » JSF
Bookmark "please help me How to make InputText field not get more than specified value" Watch "please help me How to make InputText field not get more than specified value" New topic
Author

please help me How to make InputText field not get more than specified value

Yahya Arshad
Greenhorn

Joined: May 15, 2011
Posts: 26
Hi all

i have few <h:inputText> fields i want that user cant type more than specified lenght i know there is way to validate user's input but i want that field does not accept more than specified (4) values..

input validator will need to press submit button to see but what i wan that input field does't take more than specifeid values....
please help me
Bajrang Asthana
Ranch Hand

Joined: May 24, 2011
Posts: 32
You can do this using javaScript or Ajax call on key press.
Yahya Arshad
Greenhorn

Joined: May 15, 2011
Posts: 26
bajrang asthana wrote:You can do this using javaScript or Ajax call on key press.

cam you please give me some link or explain it how i can do it
pradeep gamage
Ranch Hand

Joined: Aug 03, 2009
Posts: 85

Your Problem not clear Yahya Arshad . if you want validate textfeilds, there are lot of ways to do it. java cript, ajex ... etc. if any validation case google it.


Software Engineer(BSC):SCJP 1.5
(Knowledge is power when applied)
Bajrang Asthana
Ranch Hand

Joined: May 24, 2011
Posts: 32
You can go with this link-

http://www.mediacollege.com/internet/javascript/form/limit-characters.html

I think it would be good if we do this task using javaScript by above link.
Tim Holloway
Saloon Keeper

Joined: Jun 25, 2001
Posts: 15959
    
  19

If by "values", you mean that the inputText control should not allow more that 4 characters, just code "maxlength="4"" as an attribute of the inputText control. That corresponds directly to the HTML MAXLENGTH attribute and tells the user's browser to refuse to accept more that 4 characters in that control. No Java/JavaScript required.


Customer surveys are for companies who didn't pay proper attention to begin with.
Yahya Arshad
Greenhorn

Joined: May 15, 2011
Posts: 26
Tim Holloway wrote:If by "values", you mean that the inputText control should not allow more that 4 characters, just code "maxlength="4"" as an attribute of the inputText control. That corresponds directly to the HTML MAXLENGTH attribute and tells the user's browser to refuse to accept more that 4 characters in that control. No Java/JavaScript required.



yes thanks alot bro exactly that i was wanted
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: please help me How to make InputText field not get more than specified value
 
Similar Threads
Multiple files upload using struts
set radio button value in jsp using javascript?
textfield.focus() problem
Getting error
Find method