You need to sign in to do that
Don't have an account?
TheLearner
Changing the font color based on the condition--urgent
Hi Experts,
I need to change the font color based on the condition.
here Notice_Warning__c is forumula field, i need to change the font color of this particular condition only which i bolded below. could anyone help me please. this is my visualforce page which displaying red in color
<apex:page standardController="TW_Notice__c" >
<table width="100%" cellspacing="0">
<tr>
<td width="165px" align="right" valign="top">
<b><font color="#595959">
<apex:outputLabel value="Notice Warning" for="warn"/> </font>
</b>
</td>
<td valign="top">
<table cellspacing="0">
<tr>
<td width="15px">
</td>
<td>
<font color="red">
<apex:outputField value="{!TW_Notice__c.Notice_Warning__c}" id="warn"/>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</apex:page>
here is the formula:
Traffic_Sensitive__c is formula field which comes from the its parent record,Road_Type__c is picklist
IF
(
Traffic_Sensitive__c = 'Yes',
'Actual Start Date can move within Validity period, but Actual End Date will be fixed',
if
(
AND(
Traffic_Sensitive__c = 'No',
OR(Road_Type__c='Type 3', Road_Type__c='Type 4')
),
'Actual Start Date can move within Validity period, and Actual End Date will slide to include the full Duration', (this msg need to display in blue color)
if(
AND(
Traffic_Sensitive__c = 'No',
OR(Road_Type__c='Type 0', Road_Type__c='Type 1', Road_Type__c='Type 2')
),
'Actual Start Date can move within Validity period, but Actual End Date will be fixed',
''
)
)
)
I need to change the font color based on the condition.
here Notice_Warning__c is forumula field, i need to change the font color of this particular condition only which i bolded below. could anyone help me please. this is my visualforce page which displaying red in color
<apex:page standardController="TW_Notice__c" >
<table width="100%" cellspacing="0">
<tr>
<td width="165px" align="right" valign="top">
<b><font color="#595959">
<apex:outputLabel value="Notice Warning" for="warn"/> </font>
</b>
</td>
<td valign="top">
<table cellspacing="0">
<tr>
<td width="15px">
</td>
<td>
<font color="red">
<apex:outputField value="{!TW_Notice__c.Notice_Warning__c}" id="warn"/>
</font>
</td>
</tr>
</table>
</td>
</tr>
</table>
</apex:page>
here is the formula:
Traffic_Sensitive__c is formula field which comes from the its parent record,Road_Type__c is picklist
IF
(
Traffic_Sensitive__c = 'Yes',
'Actual Start Date can move within Validity period, but Actual End Date will be fixed',
if
(
AND(
Traffic_Sensitive__c = 'No',
OR(Road_Type__c='Type 3', Road_Type__c='Type 4')
),
'Actual Start Date can move within Validity period, and Actual End Date will slide to include the full Duration', (this msg need to display in blue color)
if(
AND(
Traffic_Sensitive__c = 'No',
OR(Road_Type__c='Type 0', Road_Type__c='Type 1', Road_Type__c='Type 2')
),
'Actual Start Date can move within Validity period, but Actual End Date will be fixed',
''
)
)
)
-Thanks
Ashlekh Gera
I amended as you said but its not working could you tell me please where im doing mistake.
<apex:page standardController="TW_Notice__c" >
<style>
.RedClass{ color:red; }
.SecondRecClass{color:red; }
.BlueClass{color:blue; }
</style>
<table width="100%" cellspacing="0">
<tr>
<td width="165px" align="right" valign="top">
<b><font color="#595959">
<apex:outputLabel value="Notice Warning" for="warn"/> </font>
</b>
</td>
<td valign="top">
<table cellspacing="0">
<tr>
<td width="15px">
</td>
<td>
<apex:outputField styleClass="IF(Traffic_Sensitive__c = 'Yes', 'RedClass', if ( AND( Traffic_Sensitive__c = 'No', OR(Road_Type__c='Type 3', Road_Type__c='Type 4')), 'BlueClass',if( AND(Traffic_Sensitive__c = 'No', OR(Road_Type__c='Type 0', Road_Type__c='Type 1', Road_Type__c='Type 2')), 'SecondRecClass' ) ) ) " value="{!TW_Notice__c.Notice_Warning__c}" id="warn"/>
</td>
</tr>
</table>
</td>
</tr>
</table>
</apex:page>
Just Change below
<span Class="{!IF(Traffic_Sensitive__c = 'Yes', 'RedClass', if ( AND( Traffic_Sensitive__c = 'No', OR(Road_Type__c='Type 3', Road_Type__c='Type 4')), 'BlueClass',if( AND(Traffic_Sensitive__c = 'No', OR(Road_Type__c='Type 0', Road_Type__c='Type 1', Road_Type__c='Type 2')), 'SecondRecClass' ) ) )}">
<apex:outputField value="{!TW_Notice__c.Notice_Warning__c}" id="warn"/>
<span>
-Thanks
Ashlekh Gea