Skip to Main Content

APEX

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

Interested in getting your voice heard by members of the Developer Marketing team at Oracle? Check out this post for AppDev or this post for AI focus group information.

Change the background color of the Item on change its value.

user1099620Jun 8 2025

Oracle Apex version 24.2

I have created on global page an item P0_YEAR of type select list .
The P0_YEAR is SELECT YEAR , STATUS FROM TABLE_YEARS , which contains also column STATUS.
STATUS can have two possible values ('OPEN', 'ÇLOSE').

When the value of the YEAR is changed, I would like to synchronize the background color of the item P0_YEAR
with the value of its STATUS.

I try to achieve this with creating the dynamic action New_YEAR at the item P0_YEAR When the Event Change
with action Execute JavaScript Code :

var item_S_Value = $v('P0_STATUS');

var item_Y_Value = $v('P0_YEAR');
var item_Y_Element = document.getElementById('P0_YEAR'); // Get item element

if (item_S_Value == 'OPEN' ) {
item_Y_Element.style.backgroundColor = '#4CAF50'; // Green
} else {
item_Y_Element.style.backgroundColor = '#eed202'; // Yellow
}

Whet the Year is changed the color is applied only for a short moment and then disappears.

What is а Change the background color of the Item on change its value.

Oracle Apex version 24.2

I have created on global page an item P0_YEAR of type select list .
The P0_YEAR is SELECT YEAR , STATUS FROM TABLE_YEARS , which contains also column STATUS.
STATUS can have two possible values ('OPEN', 'ÇLOSE').

When the value of the YEAR is changed, I would like to synchronize the background color of the item P0_YEAR
with the value of its STATUS.

I try to achieve this with creating the dynamic action New_YEAR at the item P0_YEAR When the Event Change
with action Execute JavaScript Code :

var item_S_Value = $v('P0_STATUS');

var item_Y_Value = $v('P0_YEAR');
var item_Y_Element = document.getElementById('P0_YEAR'); // Get item element

if (item_S_Value == 'OPEN' ) {
item_Y_Element.style.backgroundColor = '#4CAF50'; // Green
} else {
item_Y_Element.style.backgroundColor = '#eed202'; // Yellow
}

Whet the Year is changed the color is applied only for a short moment and then disappears.

What is the practice to achieve the change of background color in this circumstances.

Regards,
Kostadin

Comments
Post Details
Added on Jun 8 2025
0 comments
49 views