You need to sign in to do that
Don't have an account?
nask
restrict type extra characters after reaching the field max length
Is there any way to stop the user entering required number of characters when it reaches its field size. For ex if the field lenght is 10 then stop showing him characters after 10 th character even if he tries to enter any character.
Ok, the change should be as simple as below:
Now the above sample code will also handle Right Click and Paste (if greater than 10) because of onchange event. Let me know if it works for you.
Regards,
Lakshman
All Answers
http://www.mediacollege.com/internet/javascript/form/limit-characters.html
You could use the onKeypress event to check the size of the field then remove the character if the size is = to the limit.....
This is how it would be in salesforce:
Apex Class/Controller:
Visulaforce page:
The above code is tested and works fine.
Regards,
Lakshman
Thanks for all your Reply. But my problem i need to show this property in Textarea. So anybody treid this applyin on text area as there is no attribute as max lenght in that apex tag.
Ok, the change should be as simple as below:
Now the above sample code will also handle Right Click and Paste (if greater than 10) because of onchange event. Let me know if it works for you.
Regards,
Lakshman
Thanks lakshman. That was a good work around :) I had change my id of the text area field in my code, but it worked like wonder. Thanks for your time and help. Its very helpfull and usefull bit of code.
I am glad that it helped you :)
Regards,
Lakshman
Hence we can use the following tag to restrict user input to 10 characters in textArea
Hope this helps !