View Full Version : Capture F1 key

10 Feb 2014, 11:00 PM
Hi All,
Can somebody tell me how do we capture F1 key press on a field in Ext js 4.2?
I am able to capture F2 and few other function keys but not F1. F1 opens browser help.

11 Feb 2014, 1:52 AM
Browsers won't allow you to override some hotkeys. Seems like F1 is one of them.

11 Feb 2014, 2:16 AM
Thanks Evan. How do I attach a listener to all fields in a form in a single statement?
I think we can do something like this
Ext.each(Ext.query('???', ???), function(el) { el.on('click', fn); });

Can you tell me what should I give instead of question mark?

11 Feb 2014, 3:09 AM
Hello Sanjay,
I guess you need this,

Ext.each(form.getFields(), function(field) { field.on('click', fn); });

20 Aug 2014, 12:26 AM

You can disable the default help function in IE using the following two lines

document.onhelp = new Function("return false;");
window.onhelp = new Function("return false;");

Attach keyup event listener to all the fields and do what you want in the handler.

Look at this post on dynamicdrive.com for how to handle F1 key