0

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 :)

pnuts
  • 58,317
  • 11
  • 87
  • 139
Noah Martin
  • 1,708
  • 9
  • 35
  • 73

3 Answers3

2

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>
Amr Gawish
  • 2,015
  • 1
  • 17
  • 29
1

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

User404
  • 2,152
  • 2
  • 27
  • 35
  • Thanks for the response, the ESC button will invoke cancel by default on af:popup but not in this case. To close the task flow the ESC button practically has to call the return operation of the task flow. Can you help me on this? – Noah Martin Sep 06 '13 at 09:03
0

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!

Noah Martin
  • 1,708
  • 9
  • 35
  • 73