You are on page 1of 3

Oracle APEX

Notes

Syntax and shortcut for the functions within the "apex.item" Javascript
namespace.
1. Retrieve an item value
apex.item('P9_EMPNO').getValue()
$v('P9_EMPNO')
x = $v("P2_TEXT_FIELD");
y = $v("P2_DISPLAY_ONLY");
$x("P9_ENAME").value;

2. Sets an item value


apex.item('P9_ENAME').setValue('MOIN')
$s('P9_ENAME','MOIN');
Apex.item(‘P9_MGR’).setValue(‘’,’’)

3. Retrieve multiple items from an array

myArr = $v2("P9_MGR");
for (idx=0; idx < myArr.length; idx++) {
//do something with myArr[idx];
}

4. Retrieve display values from LOV, Radiogroups & Checkboxes


apex.item('P9_DEPTNO').getValue();
apex.item('P9_DEPTNO').displayValueFor(20);
And apex.item can do even more: You'll find functions for all the things you
can do with dynamic actions (show, hide, enable, disable, set focus, assign a
CSS style).

5. Show() and Hide()


apex.item( "P9_ENAME" ).hide() ;
apex.item( "P9_ENAME" ).show();

6. Enable() and Disable()


apex.item("P9_DEPTNO").disable();
apex.item("P9_DEPTNO").enable();

7. isChanged(), isEmpty(), isDisabled(), isReady()


apex.item(“P_ENAME”).isChanged();
Console.log -> false
apex.item(“P_ENAME”).setValue(“MOIN”);
apex.item(“P_ENAME”).isChanged();
Console.log -> true

8. setFocus

9. setStyle
apex.item("P9_SAL").setStyle({"background-color":"Yellow",
"font-weight":"bold"});

$x determines whether an item with the given name exists on the current
page.
5 Different Ways to Set Oracle APEX Page Item Value using Javascript
 $("#P28_SECOND" ).val(20);
 $x("P28_SECOND").value = 30;
 document.getElementById('P28_SECOND').value=40;
 apex.item('P28_SECOND').setValue(50);
 apex.items.P28_SECOND.value=60;

5 Methods to Get Oarcle APEX Page Item Value


 $("#P28_FIRST" ).val();
 $v('P28_FIRST');
 document.getElementById('P28_FIRST').value;
 apex.item('P28_FIRST').getValue();
 apex.items.P28_FIRST.value;

You might also like