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 background color for conditional text fields by click of button.

User789937-OracleMay 12 2011 — edited May 12 2011
Hi,

I am new to apex, the scenario is when i click on a button i.e. Save, it shoulld compare 2 fields P1 and P2 which are text fields.
If the value of P1 is greaterthan P2 then the whole P1 text field background color should change to "Red" otherwise in any other condition the P1 field should be "Green" color.

In which section the color function should be called on the Save button?

On the page in the HTML Header section i have added the below code but the background color is not getting set.

<script type="text/javascript">
function fncChangeColor()
{
var num1 = $v('P1');
var num2 = $v('P2');

if ( num1 > num2 ) {
document.getElementById("P1").style.background = "RED";
}
else {
document.getElementById("P1").style.background = "GREEN";
}
}
</script>

Can any one help me in moving ahead with this scenario with a detailed information.


Thanks,
Priyanka.
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on Jun 9 2011
Added on May 12 2011
5 comments
782 views