A
addi
I'm looking to perform input validation on an HTML input text element;
specifically, I'm looking to prevent anything other than numerical
characters from being entered.
I've got it working just fine for English characters by using an
'onkeypress' event handler, where basically all that is done is a
regular expression check of the character represented by
window.event.keyCode against a string containing "0123456789".
The problem I'm running into is when I switch from English to Katakana
characters - I can type in any character just fine, which is of course
wrong! The 'onkeypress' event doesn't get triggered whatsoever. I was
told by a coworker to handle the 'onpaste' event, but while that covers
yet another case for invalid input, the issue still persists: Katakana
characters of any kind can be typed into the text input without
triggering the 'onkeypress' or 'onpaste' events.
I'm using IE 5.5+ on Windows XP SP2 Japanese.
I hope someone has some experience with this. Thanks in advance for
any constructive feedback.
James
specifically, I'm looking to prevent anything other than numerical
characters from being entered.
I've got it working just fine for English characters by using an
'onkeypress' event handler, where basically all that is done is a
regular expression check of the character represented by
window.event.keyCode against a string containing "0123456789".
The problem I'm running into is when I switch from English to Katakana
characters - I can type in any character just fine, which is of course
wrong! The 'onkeypress' event doesn't get triggered whatsoever. I was
told by a coworker to handle the 'onpaste' event, but while that covers
yet another case for invalid input, the issue still persists: Katakana
characters of any kind can be typed into the text input without
triggering the 'onkeypress' or 'onpaste' events.
I'm using IE 5.5+ on Windows XP SP2 Japanese.
I hope someone has some experience with this. Thanks in advance for
any constructive feedback.
James