I havea custom save button on a visualforce page as below. I wanted to use actionstatus to show the user that the save process was taking place/in progress. However recently the redirect stopped for me, then looking at the debug logs I noticed the {!onSave} action was taking place twice.

            <apex:actionStatus id="saveCart">
                <apex:facet name="stop">
                    <apex:commandButton action="{!onSave}" value="Save" status="saveCart" reRender="msgs"/>

                <apex:facet name="start">
                    <apex:outputPanel >
                        <apex:image value="/img/loading32.gif" style="height: 15px"/>
                        <apex:commandButton value="Saving..." status="saveCart" disabled="true"/>

The onSave action as defined in my extension is:

public PageReference onSave(){

    catch(Exception e){
        return null;                

catch(Exception e){
    return null;
    }  // to allow formatting of lost lines

return new PageReference('/' + ApexPages.currentPage().getParameters().get('Id'));

I've removed the action status and stripped the save button down to the below, and this works - the {!onSave} action only gets called once and the page redirects. But as soon as I add a reRender parameter it fails to redirect again...what could cause this? And how can I get the actionstatus back in?

 <apex:commandButton action="{!onSave}" value="Save"/>

I've ruled out the browser (same behavior occurred on IE, FF and Chrome) and tried on a different instance (CS8 and CS14).

  • 1
    One thing to note, unrelated to the question, it's bad practice for maintainability to reference Salesforce resources (/img/loading32.gif) in your custom pages. If you plan to use the "loading" image, you should save a copy of the gif in a Static Resource and reference it from there instead.
    – Mark Pond
    Commented Dec 11, 2014 at 17:52

2 Answers 2


Sounds similar to an issue I faced - there are a couple of answers worth trying, but I think it is using the status with a PageBlockButton that seems to cause the issue...if you take it out of the pageblock markup, does it still fire twice?

  • Yes that's stopped the action being called twice but with no page redirection upon completion. I'll go through the linked post/answers and report back. Thanks for the link.
    – Girbot
    Commented Dec 11, 2014 at 18:52
  • Ha. Just turned off development mode/view state and the redirection has worked.
    – Girbot
    Commented Dec 11, 2014 at 18:54

I had the same issue, and BritishBoyinDC's suggestion of moving the button outside of the PageBlock also worked for me. Just in case anyone has a similar issue - the problem seems to be related to appearing at both the top and bottom of the page by default. An alternative to moving the button outside of the PageBlock which worked for me is setting a location for the of either top or bottom, so that the buttons only appear once.

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .