Make Task Flow Inline Popup to close on "esc" button

1.4k views Asked by At

I am using JDeveloper 11.1.2.3.0 I have created a task flow (with jsf pages not jsff) which I call on button click. I have chosen to display it as Inline Popup and everything works fine. It is just that it does not act like a real af:popup. When I press "esc" button the popup does not get closed. Does anyone know how to do this? Thank you

ps: I understand af:popup and displaying a task flow as inline popup are different, but I would like to make my popup to exit on "esc" at least. Or if there is any possibility to achieve what the real af:popup offers it would be great :)

3

There are 3 answers

0
Noah Martin On BEST ANSWER

I thank @Gawish for the response as it helped me to find the solution. I couldn't use that solution because there is no type:"keyPress" in clientListener in ADF 11g. However I did like this and it works very well:

window.onkeyup = function (e) {
          if (e.keyCode == 27) {
              var button = AdfPage.PAGE.findComponentByAbsoluteId('cb1');
              AdfActionEvent.queue(button, true);
              e.cancel();
          }
      }

Pay attention, e.cancel() at the end is mandatory!

1
User404 On

I guess your only option will be JS. But from what I have read, the ESC button should invoke the cancel 'function' by default... I recommend you to read this: http://www.oracle.com/technetwork/developer-tools/adf/learnmore/77-ok-cancel-support-in-dialog-351871.pdf

0
Amr Gawish On

I believe you could do something like this

<af:document title="Press ESC to Cancel" id="d1">
 <af:commandButton text="Cancel Button" clientComponent="true" id="cb1" actionListener="#{someScope.someFunction}" action="actionToCallReturn" />
 <af:clientListener method="onKeyPress" type="keyPress"/>
 <af:resource type="javascript">
   function onKeyPress(evt){
     var _keyCode = evt.getKeyCode();
     if (_keyCode == AdfKeyStroke.ESC_KEY ){    
          var button = AdfPage.PAGE.findComponentByAbsoluteId('cb1');
          AdfActionEvent.queue(button,true);
          evt.cancel();
     }
 }
</af:resource>
</af:document>