| 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: 14475
|
|
|
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
|
 |
 |
|
|
subject: please help me How to make InputText field not get more than specified value
|
|
|