How to capture ENTER and ESC key to submit form

How to capture ENTER and ESC key to submit form

I am trying to capture ENTER and ESC keys in FormPanel to Submit / Cancel the form.
'ESC' is working fine, but when i click on 'ENTER' button, the browser is refreshing instead invoking the method called in the click event of the button. Highlighted the related code in RED color.

IE issues

IE issues

I have tried the solution Animal posted above and for me it works in firefox, chrome, and safari. I have not gotten it to work in IE 6,7, or 8. Before I dig into this does Animal or anyone else know what the problem is?

I found out that hidden input element (type submit) was given class x-hide-offsets which has property visibility: hidden. That property (for some unknown reason) influence IE in the way that it ignores that submit element.

I gave that element different class which doesn't have that property (all other properties are there like big negative offsets) and now it work in IE.