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
shoba shobashoba shoba 

How to show the popup window if the save button is click

I am new in Salesforce...I want to design a pop up window.  My requirement is when Account address field is updated(Inline editing), i wan to show the popup window(In this i will display related contact). can anyone help me out to solve this issue.
<apex:page standardController="Account" extensions="testforoverridingsave">
<apex:form >
<apex:detail inlineEdit="true"/>
<apex:commandButton action="{!save}" value="Calculate" onComplete="showpopup();"/>
<style type="text/css">
.customPopup {
    background-color: white;
    border-style: solid;
    border-width: 2px;
    left: 20%;
    padding: 10px;
    position: absolute;
    z-index: 9999;
    /* These are the 3 css properties you will need to tweak so the pop 
                            up displays in the center of the screen. First set the width. Then set 
                            margin-left to negative half of what the width is. You can also add 
                            the height property for a fixed size pop up.*/
    width: 500px;
    top: 20%;

.disabledTextBox {
    background-color: white;
    border: 1px solid;
    color: black;
    cursor: default;
    width: 90px;
    display: table;
    padding: 2px 1px;

.closeButton {
    float: right;

Apex Class
public class testforoverridingsave {
    public  Account[] oldRecords;
    public  Account[] NewRecords;                  
    public testforoverridingsave(ApexPages.StandardController controller) {
   public PageReference save() {
   // Do the standard save action;
    NewRecords = [select Id,BillingAddress,BillingCity,BillingCountry,BillingCountryCode,BillingPostalCode,BillingState,BillingStateCode,BillingStreet
                         from Account
                         limit 1];
    oldRecords  = NewRecords.deepClone(true,true,true);
   update  NewRecords;            
   if(NewRecords[0].BillingCity != oldRecords[0].BillingCity){
    return null;


Thanks In Advance
Srinivas SSrinivas S
Hi Shoba,

I am not seeing any option to display a pop up from the standard detail page. You have to override the detail page with a visualforce. Please follow the below reference -

From the custom page you can achieve your scenario easily, once after clicking on save button show the pop up page.

- Please mark as solution if your problem is resolved.
shoba shobashoba shoba
Hi Srinivasa Reddy S

Thank you for your reply.  my complete scenario is "When the user tries to update the address field in detail page using inline editing. When he click SAVE button in account,at that time it should save the Account and it should show an pop up window (In that i want to display related contact Name,Address field and checkbox as well as update button)." can you please give me an idea how can i approach this. If possible send me a sample code please.

Hi Shoba,

I have some code being used in my project is like , it is a bit similar your needs. Hoping it will help you if you take it as an example and try implimenting to your needs.

function openCaptureReasonModal{
var captureReasonModal;
    function openCaptureReasonModal() {
        captureReasonModal = new SimpleDialog("SD"+Dialogs.getNextId(), {
                                                width: "200em",
                                                fixedcenter: true,
                                                modal: true,
                                                visible: false,
                                                draggable: true
        captureReasonModal.setTitle("{!reasonType} Reason");

I have called this JS function on button onclick.
Hope it will help you.Give a try. Good Luck.