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
Robert ZentgrafRobert Zentgraf 

Refresh a visualforce page after save

Hi @all,

I created a VF-page and if the user press on the save button, then the page should save the values (this is working fine) and refresh themself like pressing F5 on keyboard. Is this possible?

Regards
Robert
Balaji Chowdary GarapatiBalaji Chowdary Garapati
@Robert Zentgraf:


 Is there any return type for the save method if not, use this:

change your method to:

public pageReference yourmethodname(){

//your current logic

return ApexPages.currentPage();

}


Thanks,
Balaji
Robert ZentgrafRobert Zentgraf
Hi Bajaji,

thx for you reply, but it's not working. I'm not sure, why.
Additional information: there is a roll-up-field (sum) of all entrys (integer-values) on the VF-page. This roll-up-field is saved on the parent object. And it shows the correct value at the beginning. But when I change or add some values then this field won't be reloaded. So, if I press F5, I see the correct value!?

Regards
Robert
Balaji Chowdary GarapatiBalaji Chowdary Garapati
Is it an embded vf page? if so use the below logic:

<apex:commandLink value="Save" StyleClass="btn" action="{!youractionmethodname}" target="_top" />

or
<apex:commandButton>
<apex:commandLink value="Save"  action="{!youractionmethodname}" target="_top" />
</apex:commandbutton>

Thanks,
balaji
 
Tyler Mowbrey 1Tyler Mowbrey 1
Hi Robert,

Can you post some of the code you are using, the VF page and the save method? It would help with troubleshooting the issue.

Tyler
Robert ZentgrafRobert Zentgraf
Hi Balaji,

I tried your idea, but it's not working. The page is not refreshed in this field.

Here the VF-Page:
   <apex:form style="width:950pt;">
    <apex:pageBlock >
        <apex:pageBlockButtons >
            <apex:commandButton value="Save" action="{!saveTage}"/>
        </apex:pageBlockButtons>
    <div style="over-flow:auto; width:1200px;">
        <apex:pageBlockTable Id="Table_Zeiten" value="{!tage}" var="t" rowClasses="row1, row2">
            <apex:facet name="header">
                <apex:outputText value="Total Time: {!ParentObject__c.Field__c}"/>
            </apex:facet>
            <apex:column headerValue="Time" style="width:45pt;">
                <apex:outputtext Id="Field_Hours" value="{!t.Arbeitszeit}" visibility: {!t.visibility};"/>
            </apex:column>
        </apex:pageBlockTable>
        </div>
    </apex:pageBlock>
   </apex:form>
 
 

And Apex:
public Pagereference saveTage(){
   [...]
   return null;
}
 
 

Info to ParentObject__c.Field__c:
Data Type => Roll-Up Summary Summary
Type => SUM
Summarized Object => ChildObject
Field to Aggregate => ChildObject: Field_CO__c

Regards
Robert
Balaji Chowdary GarapatiBalaji Chowdary Garapati
Hi robert, Problem is with your apex, change it to public Pagereference saveTage(){ [...] return apexpages.currentpage(); } Return null wont make your page refresh. Thanks, Balaji
Robert ZentgrafRobert Zentgraf
Hi Balaji,

I changed the Apex, but it dosn't solve this issue. Shall I also change something in the VF-page?

Regards
Robert
Balaji Chowdary GarapatiBalaji Chowdary Garapati
Hello robert, I dont see any other issue in your page except Did it allow you to save with the above tag? Im wondering how!? Because there is no such property called visibility for apex outputtext tag, and also it is not properly mentioned,i mean the syntax doesnt seem to be correct! Anyway i dont think it is obstructing the page to load but can you remove the visibility and try?
Shobhit TShobhit T
Hi Balaji,

I have some simliar issue, I need to save the values after refresh. When i Press the Save button it saves the values but when i hit F5 or refresh the values are gone , they are not saved in my VF page. Any idea how i can achieve this ??

Best Regards,
Shobhit