2

I have been using actionStatus on visualforce pages since a long time but never came across a scenario where the method for which I use it is a PageReference method. AJAX, as far as I understand, is for refreshing a section of a page. In Pagereference, we move to another page, so does it still support actionStatus?

I tried this on a simple visualforce page - onclick of a commandbutton I call a PageReference method with Status attribute and it shows me the status but does not redirect.

Now, if I remove the status and try clicking on it, it redirects me to the other page.

Is this the expected behaviour or am I missing something here? Please advice.

Thanks in advance, Vishal

1 Answer 1

2

Normally it must work with or without actionStatus. I've just tested some examples and it works for me realy good:

This is my controller with a PageReference method (i have checked it with three variants of PageReference methods):

// Test method 1
public PageReference gotoPage(){
    PageReference p = new PageReference('/apex/test2');
    return p;
}

// Test method 2
public PageReference gotoPage(){
    return Page.test2;
}

// Test method 3
public PageReference gotoPage(){
    Account a = [select id from account limit 1];
    PageReference p = new ApexPages.StandardController(a).view();
    return p;
}

Visualforce page test1. The reRender param here is needed to be able to see the startText of the status component:

<apex:commandButton action="{!gotoPage}" value="Go" status="stat" reRender="none"/>
<apex:actionStatus startText="redirecting..." id="stat"/>

You must log in to answer this question.

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