I'm using SLDS library to decorate a VisualForce page and have got some standard validation rules defined at the back, How could I throw the error message to the VF page with using apex:pageMessages?
Please see the below code;
<apex:page standardController="Account" showHeader="false" sidebar="false" showQuickActionVfHeader="true" docType="html-5.0">
<apex:stylesheet value="/resource/slds0120/assets/styles/salesforce-lightning-design-system-vf.css"/>
<div class="slds" >
<h2 class="slds-page-header slds-text-heading--small slds-truncate" title="Account">Account - Appointment</h2>
<apex:form >
<div class="slds-box">
<apex:pageMessages />
<apex:outputPanel layout="block1" id="auth" >
<div class="slds-tile">
<div class="slds-form--horizontal">
<div class="slds-form-element">
<label class="slds-form-element__label" for="EffectiveDate">{!$ObjectType.Account.fields.EffectiveDate__c.Label}</label>
<div class="slds-form-element__control">
<apex:inputfield styleclass="slds-input slds-size--10-of-12" value="{!Account.EffectiveDate__c}"/>
</div>
</div>
<div class="slds-form-element">
<label class="slds-form-element__label" for="Authority">{!$ObjectType.Account.fields.Authority__c.Label}</label>
<div class="slds-form-element__control">
<apex:inputfield styleclass="slds-input" value="{!Account.Authority__c}"/>
</div>
</div>
</div>
<div class="slds-m-vertical--large"></div>
</div>
</apex:outputPanel>
</div>
<div class="slds-col slds-no-flex slds-align-bottom slds-m-around--small" id="saveDiv">
<div class="slds-button-group" role="group">
<apex:commandButton onclick="openConfirmationPopup()" immediate="false" styleClass="slds-button slds-button--neutral slds-button--brand" value="Save" reRender="none" />
</div>
</div>
<div aria-hidden="true" role="dialog" class="slds-modal slds-modal--large slds-fade-in-closed" id="tstpopup" >
<div class="slds-modal__container">
<div class="slds-modal__header">
<h2 class="slds-text-heading--medium">Update Movement Details</h2>
<button class="slds-button slds-button--icon-inverse slds-modal__closed">
<span class="slds-assistive-text">Close</span>
</button>
</div>
<div class="slds-modal__content">
<div>
<p>Are sure, you want to save the Movement details?</p>
</div>
</div>
<div class="slds-modal__footer">
<div class="slds-x-small-buttons--horizontal">
<apex:commandButton styleClass="slds-button slds-button--neutral" value="Cancel" onclick="closePopup()" />
<apex:commandButton styleClass="slds-button slds-button--neutral slds-button--brand" value="Confirm" action="{!save}" immediate="false" reRender="none" onclick="confirmed()" oncomplete="hideSpinner()" />
</div>
</div>
</div>
</div>
<div id="backdropDiv" class="slds-modal-backdrop slds-modal-backdrop--closed"></div>
<div aria-hidden="true" role="dialog" class="slds-modal slds-modal--large slds-fade-in-closed" id="spinnerDiv">
<div class="slds-modal__container">
<div class="slds-align-content-center">
<div class="slds-spinner--medium" >
<img src="/resource/slds0120/assets/images/spinners/slds_spinner_brand.gif" alt="Loading..." />
</div>
</div>
</div>
</div>
</apex:form>
</div>
<script>
// open the confirmation popup
function openConfirmationPopup(){
document.getElementById("tstpopup").className =
document.getElementById("tstpopup").className.replace( /(?:^|\s)slds-fade-in-closed(?!\S)/g , ' slds-fade-in-open' )
showBackDrop();
return true;
}
// close the confirmation
function closeConfirmationPopup(){
document.getElementById("tstpopup").className =
document.getElementById("tstpopup").className.replace( /(?:^|\s)slds-fade-in-open(?!\S)/g , ' slds-fade-in-closed' )
hideBackDrop();
return false;
}
// hide the transparent overlayer on message popup
function hideBackDrop(){
document.getElementById("backdropDiv").className =document.getElementById("backdropDiv").className.replace
( /(?:^|\s)slds-modal-backdrop--open(?!\S)/g , ' slds-modal-backdrop--closed' )
return false;
}
// show the transparent overlayer on message popup
function showBackDrop(){
document.getElementById("backdropDiv").className =document.getElementById("backdropDiv").className.replace
( /(?:^|\s)slds-modal-backdrop--closed(?!\S)/g , ' slds-modal-backdrop--open' )
return false;
}
// show the progress spinner
function showSpinner(){
document.getElementById("spinnerDiv").className = document.getElementById("spinnerDiv").className.replace
( /(?:^|\s)slds-fade-in-closed(?!\S)/g , ' slds-fade-in-open' )
return false;
}
// hide the progress spinner
function hideSpinner(){
document.getElementById("spinnerDiv").className = document.getElementById("spinnerDiv").className.replace
( /(?:^|\s)slds-fade-in-open(?!\S)/g , ' slds-fade-in-closed' )
return false;
}
// on confirmation we close the dialog modal and start showing the spinner
function confirmed(){
closeConfirmationPopup();
showSpinner();
}
</script>
apex:messages
is meant to be a stylable version ofapex:pageMessages
. Have you tried that?