+ Start a Discussion
Jingli Hu 3Jingli Hu 3 

add spinning image when VF page using action loading

we have a VF page, which using action in the page tab, since the action is very slow. we would like to put spinnning image. we tried the ationstatus solution. it works for click a button. but in our case, we don't have any button in the page at all. the spinning image is not showing.

Any ideas?
Alain CabonAlain Cabon

It is quite difficult to have a stable situation for a spinning image for a VF page using an action at the loading (but it is standard and stable now in Lightning).

The trick is to put the complete VFP as the result of the action status (facet stop) and activate the action status with a javascript function at the end of the page.

You can try this code: https://eltoro.secure.force.com/ShowAnImageWhileThePageIsLoading

Notice that there is no action in the <apex:page> so it is not exactly the same case and the stability is not sure whith this added action but you can try this trick.

When a page is loaded, the javascript function call at the end of the page is executed (here the call to the funciton sayHello). This javascript function call is associated with an action Function of your Visualforce named also sayHello which is real caller of the action status itself myStatus.

<apex:actionStatus id="mystatus" startText="Loading.....">
     <apex:facet name="stop">  // return of the loading
          <apex:outputPanel id="out">
           // result when the loading is complete (return of {!load} here) : your complete VF page.

Facets: stop  The components that display when an AJAX request completes. Use this facet as an alternative to the stopText attribute. Note that the order in which a stop facet appears in the body of an actionStatus component does not matter, because any facet with the attribute name="stop" controls the appearance of the actionStatus component when the request completes.


Hi @Alain,

Could you please post code over here. The link you shared is asking credentials.