Re: JavaScript, Detecting KeyUp or KeyDown KeyCode

HI: I just put a check for non display keys in the JavaScript so a user can 
still hit the delete key without causing  a problem. Only the display keys are 
blocked when the TextArea is full. It won't matter if copied text overflows the 
limit since the TextArea is validated upon submittal of the form like the other 
fields so it get's caught before PostBack.
I use the JavaScript to handle the real-time checking and display of the text 
length and a CustomValidator to check the finished length on the Client and on 
the Server, in case JavaScript would be disabled.
Anyway, it works and I spent way more time on that little bugger than it was 
worth so I called it done since it does everything I want for now.
Rick USA
  ----- Original Message ----- 
  From: Bryan Garaventa 
  To: programmingblind@xxxxxxxxxxxxx 
  Sent: Friday, July 24, 2009 2:37 PM
  Subject: Re: JavaScript, Detecting KeyUp or KeyDown KeyCode


    Sorry, I'm coming into this thread somewhat late.

    I've seen this implementation before, and it is effective. There is one 
situation you might want to code for though...

    When the onchange triggers the alert, this occurs regardless whether you 
are typing or deleting. This gets pretty annoying when you keep hitting 
backspace and the dialog keeps popping up anyway. So you may wish to code the 
onchange handler to evaluate whether the length value is less than or greater 
than the prior value, which will let you know whether someone is typing or 
deleting. 

    I know what the next question is, if the onchange occurs when typing, then 
hitting one backspace should do the trick right? 

    Not so when pasting... This can sometimes bypass the allowed character 
amount by quite a bit. 



    ----- Original Message ----- 
    From: RicksPlace 
    To: programmingblind@xxxxxxxxxxxxx 
    Sent: Thursday, July 23, 2009 7:36 AM
    Subject: Re: JavaScript, Detecting KeyUp or KeyDown KeyCode


    Hi: ARIA is out for now. I don't know anything about it and just want to 
get this bloody thing working properly with basic methods everyone understands 
at first.
    It will do a popup if you exceed the max. You can left mouse click the 
TextBox and hear how many characters you have typed and the Max number allowed. 
Putting a label under the textbox with a real-time value would just mean 
dropping a label on the form and either loading the value in the same script 
where I check for the text Overflow.
    I am not going to do that because it is useless to a screen reader user 
until they tab out of the box and would only be really effective for sighted 
folks.
    The idea of the noisy region holds promise but I don't think as a container 
for a running real-time value that changes while you type every letter. You 
might hear a 0 b 1 x 3 ... l 1942 m 1943 etc... if the value of the label 
changed for each letter entered and the region were read because of the updated 
count. Anyway, displaying a running count in a label is pretty easy and the 
alert popup and the hot key popup are about ready to implement.
    Rick USA

Other related posts: