0

I have an implementation of "RichFacesPleaseWaitBox" in my application, but has a problem.

When the user initiates any action, the status starts, displaying the modal "Waiting." When the action finishes execution, the status ends, hiding the modal "Waiting." Until here all right.

However, if the user starts the action, press the "ESC", the modal "Waiting" which had appeared, it disappears, allowing the user to click on the action again, making a new submit.

How can I block "ESC" to get workaround for this problem?

I Have tried that in my modalPanel, but not work.

<rich:hotKey id="hotKeyModalPanelSTATUS" 
handler="alert('false');"
key="esc" />    
fhgomes_ti
  • 165
  • 2
  • 15
  • no find the solution. https://community.jboss.org/message/763062#763062 post in richFaces forum no results too – fhgomes_ti Oct 08 '12 at 13:20
  • Did not ever tried this modal, but if it is based on jquery modal, you can disable esc on page load like described here: http://kylefox.ca/jquery-modal/examples/index.html (Example 5) – nigi Oct 18 '12 at 05:50

2 Answers2

2

If I got your point correct:

Import mousetrap.js file, follow the jquery documentation, and, finally do a code like this (on you modal shown event, of course):

Mousetrap.bind('esc', function(event){
  event.preventDefault();
  return false;
});

You may also want to unbind the event in the hide event of the modal, so, you can do the following on the hide event:

Mousetrap.unbind('esc');

Hope it helps.

caarlos0
  • 20,020
  • 27
  • 85
  • 160
0

Well, for now:
using onkeydown and block any esc in my app.
on first js load:

document.onkeydown   

simple:

if(event.keyCode == 27)
 return false;

but, if i want to say "Hello, u press the Esc" in some function, or window .. i can´t .. is a hardcore solution.

If anyone have a better solution, only blocking the ESC efect for request .. plz.. contribute

fhgomes_ti
  • 165
  • 2
  • 15