0

I want to create a button that effectively does the same thing as "ctrl r"

After my end user finishes updating info in the visualforce page. I want to give them to option to click this button and it will refresh the entire record page which the visualforce is embedded onto.

I honestly have no idea how to do this, my coding experience is limited. The only thing i've been able to do is get the page to reload within the visualforce page and that's not very helpful.

This is what I tried:

Visualforce code:

<apex:page standardController="Request__c" extensions="ActionRelatedList">
    <apex:form>
        <apex:pageBlock>
            <apex:commandButton value="Reload" action="{!redirect}"/>
        </apex:pageBlock> 
    </apex:form>
</apex:page>

Redirect method:

    public PageReference redirect() {
        String requestURL ='URL';
    
        PageReference newRequestURL = new PageReference(requestURL);
        newRequestURL.setRedirect(true);
        return newRequestURL;
    }

But this doesn't refresh my entire page, it just opens it within the visualforce page.

1 Answers1

0

You can do this using code below:

    <apex:page standardController="Account" >
    <apex:form >
       <apex:pageBlock>
            <apex:commandButton value="Reload" onclick="window.top.location='/{!Account.id}'; "/>
       </apex:pageBlock>
    </apex:form>
</apex:page>
user1228
  • 151
  • 6