How to set Oracle APEX page items using JavaScript?

How to set Oracle APEX page items using JavaScript?

Introduction

This tutorial will help you understand the usage of apex.item javascript API to set the value of a page item.

Syntax

setValue(pValue, pDisplayValueopt, pSuppressChangeEventopt)

Examples

Input Fields

In this example, the value of the page item P1_ITEM will be set to 10. As pSuppressChangeEvent has not been passed, the default behavior of the change event triggering for P1_ITEM will occur.

apex.item( "P1_ITEM" ).setValue( "10" );

Pop-Up LOV/ Select List

In this example, P1_DEPARTMENT is a Popup LOV page item. A pop-up LOV must have a display value and return value. The display value of P1_DEPARTMENT will be set to Sales, and the hidden return value will be set to 10.

apex.item( "P1_DEPARTMENT" ).setValue( "10", "Sales");

This example shows how to suppress the change event when there is no display value.

apex.item( "P1_DEPARTMENT" ).setValue( "10", null, true );

Reference

docs.oracle.com/en/database/oracle/applicat..