You need to sign in to do that
Don't have an account?

How change a background of a visualforce page according of the value of the field?
Hi
I have a table that will have a status value. According of the value, the color of the background cell will change.
I want know how can I do that?
For example:
<tr>
<td>Value 1</td>
<td>Value 2</td>
</tr>
Value 1 must be the color blue
Value 2 must be the color red
Best Regards
Rafael
I have a table that will have a status value. According of the value, the color of the background cell will change.
I want know how can I do that?
For example:
<tr>
<td>Value 1</td>
<td>Value 2</td>
</tr>
Value 1 must be the color blue
Value 2 must be the color red
Best Regards
Rafael
May I request you to please refer the below link for the reference.
- https://salesforce.stackexchange.com/questions/32853/can-i-change-the-color-of-a-vf-table-cell-dynamically
- https://salesforce.stackexchange.com/questions/66640/conditionally-change-background-color-of-column-using-formulas-on-style-attribu
Hope it will be helpful.Best Regards
Rahul Kumar
I have to use the tag <apex:repeat>, so the rows and collumns will be created by the repeat tag. How I can get the value of the field check if have determinated value and fill with the background color?
Do you all knows how to do that using javasscript?
It works.
But the code became too long.
Is it possible to do something like that:
<td style="{!if(conta.ServiceNow_Status__c='Qualificar','background-color:#FFD700; font-weight: bold',
if(conta.ServiceNow_Status__c == 'Service','background-color:#4682B4; font-weight: bold',
if(conta.ServiceNow_Status__c == 'Concorrente','background-color:#CD0000; font-weight: bold',
if(conta.ServiceNow_Status__c == 'Com oportunidade','background-color:#9ACD32; font-weight: bold',
if(conta.ServiceNow_Status__c == 'Outro','background-color: #B5B5B5; font-weight: bold', 'background-color:#FFA500; font-weight:bold')))))}">{!conta.ServiceNow_Status__c}</td>
in javascript?
I have at least mores 20 <td> , so I can't do this in each tag.