Get the Display and Return value of a Popup LOV item using javascript in Oracle APEX

Popup LOV is the most common LOV type used in Oracle APEX.

This blog explains how to get the Display and Return value of a Popup LOV using java script.

1) Create a Popup LOV item (In this example they are P1_COUNTRY_LOV)

2) Create two page items to store the captured display and return values.
    (In this example they are P1_COUNTRY_DISPLAYVALP1_COUNTRY_RETURNVAL)

3) Create a Dynamic action 

        Event: Change

        Selection Type: Item

        Item: P1_COUNTRY_LOV

4) Create a True Action

     Action: Execute JavaScript Code

     Paste the below code:
//to get the return value of the popup lov 
let returnVal  = apex.item("P1_COUNTRY_LOV").getValue();

//to get the display value of the popup lov 
let displayVal = document.getElementById("P1_COUNTRY_LOV").value;

//to set the captured value to page Items (for using the captured values in any other event)
apex.item("P1_COUNTRY_DISPLAYVAL").setValue(displayVal );
apex.item("P1_COUNTRY_RETURNVAL").setValue(returnVal );

Note:  If the value of the changed Popup LOV has to be set to another Popup LOV, use the below java script code.
apex.item("YOUR_POPUP_LOV_ITEM").setValue(returnVal,displayVal,true); 
 

Click here for DEMO


HAPPY CODING!!! 
Thank you :)   

Comments

  1. gracias estaba buscandolo y buscandolo

    ReplyDelete
  2. How to use this method for Interactive grid, when I need some columne to be POPup LOV

    ReplyDelete

Post a Comment

Popular posts from this blog

Display and Edit CLOB Content in Oracle APEX

Allow Only Number/Decimal values In a Number/Text Field Using JavaScript in Oracle APEX

Copy the value of an Item to Clipboard in Oracle APEX