EDIT: Assume this is my VF page which i have simple input:
<apex:page standardController="Account" extensions="ErrorMessageInVfController">
<apex:form >
<apex:pageblock >
<apex:pageMessages id="showmsg"></apex:pageMessages>
<apex:panelGrid columns="2">
Account Name: <apex:inputText value="{!acc.name}"/>
Account Number: <apex:inputText value="{!acc.AccountNumber}"/>
Account Phone: <apex:inputText value="{!acc.phone}"/>
Account Site: <apex:inputText value="{!acc.site}"/>
Account Industry: <apex:inputText value="{!acc.industry}"/>
<apex:commandButton value="Update" action="{!save}" style="width:90px" rerender="showmsg"/>
</apex:panelGrid>
</apex:pageblock>
</apex:form>
</apex:page>
Controller:
public with sharing class ErrorMessageInVfController {
public void save(){
//... logic ... more code:
//insert myRecord
ApexPages.addmessage(new ApexPages.message(ApexPages.severity.CONFIRM,'Saved successfully!'));
}
The problem with the above approach is that once it displayed the ApexPages.message there is no way to close it will always be there until user refresh the entire page.
I'm looking a way to show the message and disappear by itself or have a close button next to the message.
I need a popup message to be displayed after user clicks on Save button in VF
i have searched on the net but could not find anything close to it either its popup or a message is fine and any idea?
onclick="return confirm('are you sure?');"
on your commandButton?confirm message
i will update my question with more detail.