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!

Set Style Dynamic Action against 'display' page items?

AndyHJun 27 2024

APEX 23.1

I have a dynamic action that takes two page item values, calculates a value from them and then sets a display field with that value.

I would then like to ‘colour’ the display field background depending on the value recorded - like a traffic light display?

I thought I could use the ‘Set Style' dynamic action, but this didn't have any effect.

When I looked at the generated page, I could see that the displayed field didn't match the expected name - something like the following is generated:

<div> 
<input type="hidden" id="P1_HSE_DISPLAY" name="P1_HSE_DISPLAY" value="High"> 
<input type="hidden" data-for="P1_HSE_DISPLAY" value="sdlkfjslkdfjslkj"> 
<span id="P1_HSE_DISPLAY_DISPLAY">"High"</span> 
</div>

If I use ‘Set Style and refer to P1_HSE_DISPLAY, then styling information is added to the hidden input field.

They only way I've found to add the required styling is through javascript that refers to the ‘span’ e.g.

apex.item("P1_HSE_DISPLAY_DISPLAY").setStyle("background-color",apex.item("P1_HSE_CLR").getValue());

This sounds like something other than the correct/declarative way of doing things?

Any ideas?

Comments
Post Details
Added on Jun 27 2024
4 comments
803 views