You need to sign in to do that
Don't have an account?
nesh
conditionally highlight a custom field in VF -Highlight in RED if below 75%
How to highlight a custom field based on condion( Highlight in RED if below 75% ).
custom field name:Total Grade.(data type :percentage )
my vf page code:
<apex:pageblockSection title="Total Grade">
<apex:outputField value="{!newapp.Total_grade_1__c}" styleclass="{!if((newapp.Total_grade_1__c<75), 'color:red', '')}" /
</apex:pageblockSection>
above code doesnt work. my custom field data type is percentage...Please help me.
Hi Nesh,
You can do this by direct rendering option in vf page or by using javascript.
Try the following using rendered option in output field.
<apex:pageblockSection title="Total Grade">
<apex:outputField value="{!newapp.Total_grade_1__c}" rendered="{!newapp.Total_grade_1__c < 75}" style="color:red;" />
<apex:outputField value="{!newapp.Total_grade_1__c}" rendered="{!newapp.Total_grade_1__c > 75}" />
</apex:pageblockSection>
otherwise use javascript,
<apex:page>
...........................
<script>
function showhide(){
if(document.getElementByID("{!$Component.totalgrade}").value > 75){
document.getElementByID("{!$Component.totalgrade}").style.display = "red";
}
else{
document.getElementByID("{!$Component.totalgrade}").style.display = "none";
}
}
</script>
................
<apex:form>
.....
<apex:pageblockSection title="Total Grade">
<apex:outputField value="{!newapp.Total_grade_1__c}" style="display:none;" />
</apex:pageblockSection>
......
<apex:commandButton value="save" action="{!save}" onclick="return showhide();" />
</apex:form>
<apex:page>
Hope so this helps you...!
Please mark this answer a Solution and please give kudos by clicking on the star icon, if you found this answer as helpful.
ABOVE TWO CONDITION DOESNT WORK...
My Requirement: total grade fielld update from workflow rule----data type -percentage.
Highlight in RED if below 75%---total grade=56%
If above 75% display like-Total GRADE=80%
How to call apex class from List View Custom Button ..my inside apex class code is here- how to use it...Please help me