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
NehaKSNehaKS 

Popup window closes even if error message on popup

Hi,

 

I have a button save and close on popup window. The data is saved in database and the the window closes.

 

But if any error messages occurs it still closes the window.

 

Kindly help me out with this issue

 

 

NehaKSNehaKS

I am closing the popup window using javascript.

 

<apex:commandbutton action="{!updates}" id="updatebutton" value="Save & Close" style="left:65px;position:relative;" immediate="false" oncomplete="hidepopup(this);" rerender="msg1" />

 

function hidepopup(cb)
    {
        var popUp = document.getElementById("showme1");
        popUp.style.display = "none";
        window.location.href=window.location.href;
     }

 

Is there a way where i can check if my popup window contains page messages.

If pop window has page message then it should not close else it should.

 

Can i give such kind of condition in javascript.