On 10/18/07, Gareth Evans <[EMAIL PROTECTED]> wrote:
> ...
> Problem is, I can already see a few problems.
> 1) prevents copy & paste (which can be solved with a blur handler to strip
> non numeric characters out, but isn't an issue in this particular usage
> scenario anyway)
> 2) the number keypad no longer works for entering numeric data;
> String.fromCharCode(e.keyCode) returns 'a' for 1, 'b' for 2, etc when I
> press keys on the numeric keypad but works fine for the numbers above the
> keys on my keyboard.

You'll probably want to validate based on e.keyCode alone.  Also
beware that different browsers and different OSs will report different
keyCodes for non-letter keys (see
http://www.quirksmode.org/js/keys.html for a start)

It gets complicated, so you may consider another approach such as an
onblur validation or a check every few seconds.

- Ken

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups "Ruby 
on Rails: Spinoffs" group.
To post to this group, send email to rubyonrails-spinoffs@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/rubyonrails-spinoffs?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to