• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

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

 
Yahya Arshad
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
You can do this using javaScript or Ajax call on key press.
 
Yahya Arshad
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 85
Eclipse IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Bajrang Asthana
Ranch Hand
Posts: 32
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 18212
53
Android Eclipse IDE Linux
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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.
 
Yahya Arshad
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic