Another Salesforce blog!!!

Salesforce, Apex

apex:actionFunction javascript


 

<apex:actionFunction name="clearFormFn"  action="{!clearForm}" status="overlayStatus" rerender="{!$Component.myForm}" />

<apex:actionStatus id="overlayStatus" onstart="showOverlay();" onstop="hideOverlay();"/>
public void clearForm()
{
   //more code here....
}
<div id="overlay"></div>
<script type="text/javascript">
    Sfdc.onReady(function()
    {
	SfdcApp && SfdcApp.Visualforce && SfdcApp.Visualforce.VSManager && SfdcApp.Visualforce.VSManager.vfPrepareForms(["myPage:myForm"]);
    });
</script>
<script type="text/javascript">
        //---------------------------------
        // Function to display overlay div
        //---------------------------------
        function showOverlay() {                       
            var o = document.getElementById('overlay');
            o.style.visibility = 'visible';
            
            //create inner div
            var i = document.createElement('div');
            i.id  = 'overlayInner';
            i.style.position = "fixed";            
            i.style.top = (o.clientHeight)/2 + 'px';
            i.style.left = (o.clientWidth)/2 + 'px';
            
            //append inner div inside overlay div                
            o.appendChild(i);             
        }
        //---------------------------------
        // Function to hide overlay div
        //---------------------------------
        function hideOverlay() {
            var o = document.getElementById('overlay');
            o.style.visibility = 'hidden';                                               
        }        
    </script>

Leave a Reply

Your email address will not be published.

*