Saturday, June 19, 2010

Display LOV on F9 Key in Oracle ADF


Recently i learned from OTN forums how can we display LOV by pressing F9 key on field (which is Oracle forms default key to display LOV and migration to ADF would required developers to keep the common features alive) the answer is by using JavaScript we can control which key has been pressed by user or which mouse button is pressed without a round trip to server.

Lets get into example:

- Create Simple LOVs on Employees table's field 'DepartmentId' and 'ManagerId'

- Create metaContainer facet in af:document (Recommended area to put javascript code)
- In structure window right af:document and choose insert inside > JSF Core > facet

- Choose metaContainer from list and press OK

- Drag af:resource component to metaContainer facet from Component palette and choose type 'javascript'

- Go to page source and create a function showMyLOV as shown in the slide
Note: You can ignore any errors in the structure window regarding "Expected name instead of &."

- Add a client listener to the field you want to display Lov on F9

- Run the page and test

Download the example

More Reading on JavaScript implementation in Oracle ADF check Webuser Interface  guide

Happy JDeveloping,


  1. Thanks shrikanth i am glad you found it useful

    Keep JDeveloping,

  2. Man you are the best.
    but can i ask another question plz?
    how can i enter in query mode using f7
    and also execute query using f8
    please if you know how, you will help me .
    thanks for sharing

  3. Ali,

    Web application usually dont have Enter query and execute query mode.

    you should provide search option instead.

  4. thanks for answer,
    i mean can i map f7 to do like search button
    and f8 to do like refresh button?

  5. It worked great. Thanks a lot. I have also added this code to my af:PageTemplateDef, now it works for my entire project without additional effort apart from putting the Client-Listener properly. Below you will find the code fragment in case it can be usefull for any of you Guys (it saves tons of time)


    function showMyLOV(actionEvent) {
    var source = AdfPage.PAGE.getActiveComponent();
    if (actionEvent.getKeyCode() == AdfKeyStroke.F9_KEY && source.getTypeName() == "AdfRichInputListOfValues") {