Wed. Jan 26th, 2022

Requirement: I have a Select List displaying the Fruit Name, and the Display Value and the Return Value for the Fruits are different. I have a button called “Get Selected Fruit Details

Now, after the page loads, if the user clicks on the “Get Selected Fruit Details” button, it will display an alert message “Please select the Fruit Name

If the user selects the Fruit Name as Mango. It will display an alert message “Display Value for the Selected Fruit is: Mango and Return Value is: MANGO

Solution: For the solution of the above requirement follow the steps as shown below:

Step 1: Create a Blank Page with the Name as “Display Select List Value“.

Step 2: Create a Region with Title = “Display Select List Value” and Type = “Static Content”

Step 3: Create an Item inside the Region created in Step 2. Set the properties for the Item as below:

  • Name: P9_FRUIT_NAME
  • Type: Select List
  • List of Values Type: Static Values
  • Static Values:

Step 4: Create a button and set the below properties:

  • Button Name: P9_GET_SELECTED_FRUIT_DETAILS
  • Label: Get Selected Fruit Details

Step 5: Create a Dynamic Action for the button and set the Name as getSelectedFruitDA

For the True outcome of the Dynamic Action set the Action as “Execute JavaScript Code“, and write the below JavaScript code

if ($v('P9_FRUIT_NAME') === '') {
    apex.message.alert('Please select the Fruit Name');
} else {
    var retValue, displayValue;
    retValue = apex.item('P9_FRUIT_NAME').getValue();
    displayValue = apex.item('P9_FRUIT_NAME').displayValueFor(retValue);
    apex.message.alert("Display Value for the Selected Fruit is: " + displayValue + " and Return Value is: " + retValue);
}

Save and run the application. Thus, the ran application is shown below:

Click on the “Get Selected Fruit Details” button, it will display an alert message “Please select the Fruit Name

Select the Fruit Name as Mango, and it will display an alert message “Display Value for the Selected Fruit is: Mango and Return Value is: MANGO

Hence, the solution to our requirement.

If you like the post please comment, share, and do join me on Facebook. Please subscribe to my YouTube Channel for video tutorials.

Thanks & Regards,
Susanto Paul

 2,687 total views,  2 views today

By Susanto Paul

Susanto is an Oracle ACE, a qualified MCA, MBA, and a highly-skilled Senior Oracle Specialist. He is an enthusiastic Blogger and YouTuber who helps learners to solve their complex problems more efficiently. He has 9+ years of experience in multiple technologies like AWS, Oracle ADF, Oracle APEX, Oracle JET, Oracle VBCS, Oracle IDCS, Oracle PL/SQL, Oracle Integration Cloud, Java, JDBC, Servlets, JSP, Spring, Hibernate, HTML5, CSS3, JavaScript, TypeScript, NodesJS, Angular, MySQL, Oracle WebLogic Server, JUnit, JMeter, Selenium Web Driver, etc. He is a certified: Oracle Certified Professional Java SE 6 Programmer, Oracle ADF 11g Certified Implementation Specialist, Oracle Cloud Platform Application Integration 2020 Certified Specialist, Oracle Cloud Infrastructure Foundations 2020 Certified Associate, and Oracle Cloud Infrastructure Developer 2020 Certified Associate

Leave a Reply

Your email address will not be published. Required fields are marked *

satta king chart