Catch enter press on textfield with dynamic action
PeetebaSep 26 2011 — edited Sep 27 2011Hello all,
I have a page in APEX 4.0.2 and I want to trigger a dynamic action on a textfield when the user presses the ENTER key.
If I would only use HTML and JavaScript, I would do something like
$x('P2_TEXT').onkeyup=function(e){
if(e.which == 13){
alert('You just hit the ENTER key!');
}
}
In APEX, I have a dynamic action which binds a key release event to the item but I can't figure out how to find key that was pressed.
If I use e.which, it works in Firefox but not in Google Chrome and if I use event.which, it works in Chrome and not in Firefox.
Very strange but true!
I've been trying some of the this. variables of APEX but none of them seems to hold the key pressed.
Can you help me out?
Please note that I don't want to submit the page!!
If there is a solution in APEX 4.1, please tell me so. We are thinking about upgrading but there is no haste at the moment :-)