[Dojo-interest] binding to Ctrl-S to enable keyboard-triggered save

Bill Higgins billhigg at gmail.com
Thu Jan 11 14:31:55 MST 2007


I'm trying to enable the classic Ctrl-S keyboard combination to allow a
keyboard-driven save of a form.  I'm able to bind to generic Ctrl+keystroke
in Firefox by doing the following:

dojo.event.connect(myForm.domNode, "onkeypress", function(e) {
    if (e.ctrlKey) {
        alert("Ctrl key pressed: " + e.charCode);
        e.preventDefault();
    }
});

In Firefox this displays "Ctrl key pressed: 115".
On IE, nothing happens when the Ctrl key is pressed.

A few questions to the group:

- How to logically correlate the magic number 115 with the 's' key?
- Any idea how to make IE pick up the Ctrl+keystroke?
- Is there a OS-neutral way to connect to the meaning of "Ctrl-s" in
Windows?  (E.g. "Apple key+s" in Mac)

Thanks in advanced.

-- 

- Bill
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://dojotoolkit.org/pipermail/dojo-interest/attachments/20070111/6b5b8350/attachment.html


More information about the Dojo-interest mailing list