Reputation: 107
May I change the background color when a user clicks a button?
When that button (P21_CHECKOUT_BUTTON)
is pressed, execute a process that changes the status OFF to ON or ON to OFF.
At this time, I want to change region (P21_CHECKOUT)
color, ON: White OFF: YELLOW.
I found old question, but it is working only javascript. Change Background-color to button in APEX Oracle
If there is no way to best solution for newer versions, then use this javascript to set the value to the item when you run PL/SQL. The above question feel a bit old-fashioned. (but enough good.)
Can someone please give me an answer? Thank you in advance :)
Upvotes: 0
Views: 4882
Reputation: 18685
The link in the question uses jquery to manipulate the DOM element and set the background color. This could work but it definitely is not upgrade proof. It can be achieved declaratively in apex as well and that is a lot safer over time.
Here is an example of setting background color of a region click of a button. The same technique can be applied to add/remove the background color class for your process:
Page has a button (BUTTON1) and a region (REGION1)
That's all there is to it. The class "u-color-7-bg" comes from the universal theme reference application (Apex Universal Theme > Reference > Color and status modifiers). There are a number of predefined classes for block/text/background/border that can be used. These are upgrade proof and it is strongly advised to use these over home brewn solutions
Upvotes: 4