views:

47

answers:

3

Hi there,

I have a very simple HTML form, only containing a submit button and a textarea. Is there an easy way to use a hotkey to submit this form, as an alternative to pressing the button?

Thanks in advance :-)

+1  A: 

Submit buttons can have accesskeys, but there are drawbacks. Users would probably be better off just hitting the tab key to focus the submit button, and then pressing enter.

David Dorward
This is what I'm looking for as the website isn't aimed toward the greater public so the browser difference in handling accesskeys is no problem :-)
Chris
A: 

Have a look at this solution.

klausbyskov
The trouble with this is that users expect the enter key to create a line break when they are in a textarea.
David Dorward
That was my first thought as well, David. Thanks anyway.
Chris
+1  A: 

you can use the "keyDown", "keyPress" events if you use a JS library (JQUERY or MOOTOOLS).. you can program your own Ctrl+S to submit.

On JQuery see this http://api.jquery.com/keypress/

On Mootools see this http://mootorial.com/wiki/mootorial/03-native/05-event

pleasedontbelong
Ctrl+S (in Firefox for Windows at least) usually means "Save this page". Messing with user expectations is usually not a good idea.
David Dorward
I'll take a look at jQuery, thank you.
Chris