function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
RichardR1RichardR1 

reRender not working on formula fields

Hi all, I created a Visualforce page where I need to rerender some formula fields (number output) but I cannot get them to rerender. I was able to do rerender on other elements in my page though, such as an html text.
<apex:page standardController="Contact" extensions="npsExtension" showHeader="false" sidebar="false">
<apex:form >
  <apex:actionFunction name="save" action="{!saveRecords}" reRender="k,l,m,n" />
<table >
   <tr >
        <td >
            <apex:outputText id="k" style="color:{!if(nps.Phone_Call__c='No','red','black')}"  value="Phone Call"/>
        </td>
        <td><apex:inputField onchange="myFunction()" value="{!nps.Phone_Call__c}" /></td>
        <td><apex:outputField id="l" value="{!nps.Phone_Call_Score__c}" /></td>
        <td><apex:outputField id="m" value="{!nps.Phone_Call_Weight__c}" /></td>
        <td><apex:outputField id="n" value="{!nps.Relationship_Score__c}" /></td>
    </tr>
</table >
<script>
   function myFunction(){
       save();
   };
</script>
</apex:page>

 
Best Answer chosen by RichardR1
RichardR1RichardR1
I was able to rerender them when the VF page is put on the same object but when I put them on a different object record detail page, that's when the rerender does not work for formula fields. I was able to come up with the solution to use apex:iframe which shows a VF page that has a standard controller of the same object 

All Answers

Sai PraveenSai Praveen (Salesforce Developers) 
Hi Richard,

As per the below answer we cannot rerender based on formula field until the record is saved. Can you check the below approaches suggested.

https://salesforce.stackexchange.com/questions/136418/how-to-render-a-formula-field-on-the-basis-of-another-input-field-in-vf-page

If this solution helps, Please mark it as best answer.

Thanks,
 
RichardR1RichardR1
I was able to rerender them when the VF page is put on the same object but when I put them on a different object record detail page, that's when the rerender does not work for formula fields. I was able to come up with the solution to use apex:iframe which shows a VF page that has a standard controller of the same object 
This was selected as the best answer