+ Start a Discussion
LanceCresswellLanceCresswell 

AJAX Update Request

Hi,

How do I ensure an AJAX update request finishes before users click elsewhere on the VF page?

Here's my VF code...

                        <apex:inputField value="{!s.Quantity}" style="width:70px" required="false">
                            <apex:actionsupport event="onchange" action="{!ApprovalRequired}" rerender="selected" status="actionStatusQuantity">
                                <apex:param value="{!s.PriceBookEntryId}" assignTo="{!toCurrent}" name="toCurrent"/>
                            </apex:actionsupport>
                            <apex:actionStatus id="actionStatusQuantity" startText="Calculating..." stopText=""/>                           
                        </apex:inputField>

This displays a processing message but does not stop users clicking elsewhere e.g. on a Save commandbutton, before it has completed.  I need it to complete and the rerender="selected" command to always run.

Regards
Lance Cresswell
ShashForceShashForce
Hi Lance,

You can probably work around this by greying out other buttons until the action is completed. You can use the "disabled" paramenter in the command button to grey it out or enable it to be clicked, using rerender.

Thanks,
Shashank
krprkrpr
replace the action status with following code : Try to get the Image you wish to present to user similar to HTML5 etc.

<apex:actionStatus id="plswait">
                <apex:facet name="start">        
                <div id="loadingWSO" class="waitingSearchDiv waitingSearchDivOpacity" style="width:100%;height:5000px;display:block;background-color:grey;"/>
                <div id="loadingWS" class="waitingSearchDiv" style="width:100%;height:100%;display:block;">
                <div id="waitingHolder" class="waitingHolder" style="margin-top:0px;width:180px;">
                    <img class="waitingImage" src="/img/loading.gif"/>
                    <span class="waitingDescription">Processing Message</span>
                </div>
                </div>                                 
            </apex:facet>
       </apex:actionStatus>