I would Like to add Error message on visualfocepage if save button logic has error. this part is working ,but i need to show popup if there are no error messages.how to add condition to show popup only if there are no error messages and if error messages found then dont show popup(display only error messages) SUDO:
if(errors==NULL){
showpopup
}else{
show error messages &ignore popup
}
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:commandButton value="Save" action="{!save}" rerender="showmsg" oncomplete="window.open('/apex/popuppage','_blank','height=400,location=no,resizable=yes,toolbar=no,status=no,menubar=no,scrollbars=1', 1)" />`
controller
if(notAllow){
Apexpages.addMessage(new ApexPages.Message(ApexPages.Severity.ERROR,'record already has an active status'));
}