|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
Need Help!
Well I am just stuck in kind of piculiar problem.
I hope some one could help with it. I have a text field where user can put certain number of character (10). If any user exceeds that number then the input will not be taken. The problem is when a user paste some text which is over 10 character then i cannot pop an error message right away. Is there any way that as soon as user paste characters more than 10 by right clicking the mouse and then select paste, an error message can be provided? |
|
#2
|
||||
|
||||
|
hmm.. maybe some kind of javascript function code help?
haha not too sure though all the best anyways |
|
#3
|
||||
|
||||
|
I take it you are trapping each keypress using the onKeyDown= function?
Which 'Text Field' type are you using? <input type=text...> or <textarea...>? I suggest you try using the onChange function. Here's an example for both types. <textarea ... onChange="if (this.value.length > 10) {alert('You idiot, no more than 10 characters!'); this.value=''; this.focus();}" ...></textarea> and <input type=text maxlength="10" ...> Hope that helps.
__________________
Hawk - The flightless Kiwi bird Did I help you out? Click the and agree.
|
![]() |
| Viewing: ASP Free Forums > Programming > HTML, JavaScript And CSS Help > Need Help! |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|