The blog for hints & tips about Oracle Application Development Framework and Mobile Application Framework

  • ADFv
    February 26, 2011

How to launch LOV and Date dialogs using the keyboard

Frank Nimphius
Master Principal Product Manager

Using the ADF Faces JavaScript API, developers can listen
for user keyboard input in input components to filter or respond to specific
characters or key combination. The JavaScript shown below can be used with an af:clientListener tag
on af:inputListOfValues
or af:inputDate.
At runtime, the JavaScript code determines the component type it is executed on
and either opens the LOV dialog or the input Date popup.  



    * function to launch dialog if cursor is in
LOV or

    * input date field

    * @param evt argument to capture the
AdfUIInputEvent object


  function launchPopUpUsingF8(evt) {

     var component = evt.getSource();

if (evt.getKeyCode() == AdfKeyStroke.F8_KEY) {

//check for input LOV component

       if (component.getTypeName() ==
'AdfRichInputListOfValues') {


           //event is handled on the client. Server does
not need

           //to be notified



        //check for input Date component      

        else if (component.getTypeName() ==
'AdfRichInputDate') {

          //the inputDate af:popup component
ID always is ::pop

          var popupClientId = component.getAbsoluteLocator()
+ '::pop';

          var popup =

          var hints = {align :

               alignId : component.getAbsoluteLocator()};


          //event is handled on the client. Server does
not need

          //to be notified






The af:clientListener
that calls the JavaScript is added as shown below.

<af:inputDate label="Label 1"

method="launchPopUpUsingF8" type="keyDown"/>


As you may have noticed, the call to open the popup is
different for the af:inputListOfValues
and the af:inputDate.
For the list of values component, an ADF Faces AdfLaunchPopupEvent is queued with the LOV
component passed s an argument. Launching the input date popup is a bit more
complicate and requires you to lookup the implicit popup dialog and to open it
manually. Because the popup is opened manually using the show() method on the af:popup component, the
alignment of the dialog also needs to be handled manually. For this, the popup
component specifies alignment hints, that for the ALIGN_END_AFTER hint aligns
the dialog at the end and below the date component. The align Id hint specifies
the component the dialog is relatively positioned to, which of course should be
the input date field.

The ADF Faces JavaScript API and how to use it is further explained
in the Using JavaScript in ADF Faces Rich
Client Applications
whitepaper available from the Oracle Technology Network


An ADF Insider recording about JavaScript in ADF Faces can
be watched from here


Be the first to comment

Comments ( 0 )
Please enter your name.Please provide a valid email address.Please enter a comment.CAPTCHA challenge response provided was incorrect. Please try again.