function readOnly(count){ }
Starting November 20, the site will be set to read-only. On December 4, 2023,
forum discussions will move to the Trailblazer Community.
+ Start a Discussion
Sateesh KumarSateesh Kumar 

PopUP Box on Standard Page after Clicking on Save button

Hi,
I have requirement to show a popup box after clicking on the save button on standard page. when some XYZ field != Null, I achived this by creating a visualforce page but the problem here is the POPUP shows on (Onload or Refresh) of a page. I need to stop the popup on onload. How can i achieve this. Below is my code.

​<apex:page standardController="Account" rendered="{!IF(((Account.Type='Dealer' || Account.Type='Flooring Dealer'|| Account.Type='Distributor'||Account.Type='Distributor - IBU'||Account.Type='Retail / DIY' ) && (Account.Account_Status__c = 'Current Customer') && (Account.distributor_locator_relevant__c = 'Yes') && (Account.distributor_locator_movex_ad_number__c = Null || Account.distributor_locator_movex_ad_number__c = '')) ,true,false)}">
 <script type = "text/javascript"> 
     callMe(); 
     //window.onload=function() 
     {
       var url = window.location.href;
       alert(url.indexOf('/006') + ' hiii '+url.indexOf('/e'));
        if(url.indexOf('/006')!=-1 && url.indexOf('/e')!=-1) 
        {
        alert('test');
        }
     } 
         
      if($('#save').click())
          {
          function callMe()
          { 
          var result = confirm("Do you want this location to display in the Dealer Locator on the website? You’ve checked the Distributor Locator Relevant? box, which usually means you want that.Right now, there’s no DL Movex AD number in the distributor locator section of the website - that’s the number that shows that we’re delivering products that reach this location.Without that number, this location won’t show up on the website in the Distributor Locator.Please work with Customer Service to get this fixed.");
if(result) window.parent.location.href = '/{!Account.Id}/e?retURL={!Account.Id}';
          } 
          } 
      </Script> 
</apex:page> 
pconpcon
If you want this to only show on save, you can wrap your <script> section in an apex:outputPanel and a layout of "none."  Then rerender the outputPanel to fire the JavaScript when the saved button is pushed.  This is pretty convoluted in my opinion.  Alternatively you could load jQuery into your page and bind the onClick of the button to your function call.
 
jQuery.noConflict();

jQuery('input [id $= "buttonId"]').click(function () {
    var result = confirm("foobar");
});

This way the only the click will fire the javascript function