You need to sign in to do that
Don't have an account?
Validation Rule Error on Top of page not working for <apex:pageMessages />
I have a few visualforce pages I'm developing to be inline on a standard page layout.
I can get my pages to dispay the normal validation rule errors if they are displayed on a specific field in <apex:pageMessages/>.
However, if the validation rule error is supposed to be displayed on "Top of Page", it doesn't display anywhere. I am guessing the errors want to display at the top of the standard page layout (not visualforce portion) but because the error is happening when i try to click what is essentially a quicksave button on the VF part it never gets to that step.
Does anybody know what I might be doing wrong or how to overcome this?
Here is my controller class:
public class OppVFPageSaveExtension { ApexPages.StandardController stdCtrl; //global variables private final Opportunity objOpportunity; //end of global variables //standard controller constructor public OppVFPageSaveExtension(ApexPages.StandardController controller) { this.objOpportunity=(Opportunity)Controller.getrecord(); stdCtrl=Controller; } //End of Standard Controller Constructor public Opportunity getOpp() { return (Opportunity) stdCtrl.getRecord(); } //Method Called on to update Holiday Public PageReference save() { try { Update objOpportunity; PageReference OppPage=new PageReference('/'+getopp().id+'?inline=0'); OppPage.SetRedirect(true); return OppPage; } catch(System.DMLException e) { return null; } Return NULL; } //end of Method Update Oppty }
Here is my VF Page:
<apex:page standardController="Opportunity" showHeader="true" tabStyle="Opportunity" extensions="OppVFPageSaveExtension"> <style> .activeTab {background-color: #E4C030; color:white; background-image:none} .inactiveTab { background-color: lightgrey; color:black; background-image:none} </style> <!--This part here is just for getting conditional qualification info on the opp, if required. Otherwise it doesn't render--> <apex:pageMessages /> <apex:outputPanel id="QualPageBlock" rendered="{!(Opportunity.z_Has_this_opp_had_QualChecklistComplete__c == 0 && Opportunity.Does_Opp_Require_Qual_Profile__c == 1)}" > <apex:form > <apex:pageBlock title="Qualification Checklist" id="none"> <apex:pageBlockButtons > <apex:commandButton action="{!save}" value="Quick Save Changes"/> </apex:pageBlockButtons> <apex:pageMessages /> <!--<apex:pageMessage severity="error"> <apex:Messages /> <apex:pageMessages /> To access all the opportunity fields, please submit the following "Qualification Checklist". <br/> The picklists are required; the details fields are optional</apex:pageMessage>--> <apex:pageBlockSection columns="3"> <apex:OutputText >1. Are we the first in (are we setting the vision)? If yes, describe the vision.</apex:OutputText> <apex:pageBlockSectionItem > <apex:inputField value="{!Opportunity.Qual1_AreWeFirstIn_PL__c}" required="true" style="text-align: left !important;padding-left: 2px !important;padding-right: 2px !important; width:98%;" > <!--<apex:inlineEditSupport event="ondblclick"/>--> </apex:inputField> <apex:pageBlockSection columns="1" title="Please Select Strategic Business Impacts" id="SBIs"> <!--<apex:inlineEditSupport event="ondblclick"/>--> <apex:inputField value="{!Opportunity.SBI_ICS__c}" /> <apex:inputField value="{!Opportunity.SBI_IC__c}" /> <apex:inputField value="{!Opportunity.SBI_IP__c}" /> <apex:inputField value="{!Opportunity.SBI_IR__c}" /> <apex:inputField value="{!Opportunity.SBI_IE__c}" /> <apex:inputField value="{!Opportunity.SBI_DTTP__c}" /> <apex:inputField value="{!Opportunity.SBI_ETR__c}" /> <apex:inputField value="{!Opportunity.SBI_TFP__c}" /> <apex:inputField value="{!Opportunity.SBI_CS__c}" /> <apex:inputField value="{!Opportunity.SBI_CP__c}" /> <apex:inputField value="{!Opportunity.SBI_Inn__c}" /> </apex:pageBlockSection> </apex:PageBlock> </apex:form> </apex:outputPanel> <!-- This is the default tabbed portion of the display and is also condition but is there most of the time --> <!--<apex:pageMessages />--> <apex:tabPanel switchType="client" selectedTab="name2" id="theTabPanel" tabClass="activeTab" inactiveTabClass="inactiveTab" rendered="{!(Opportunity.z_Has_this_opp_had_QualChecklistComplete__c == 1 || Opportunity.Does_Opp_Require_Qual_Profile__c == 0)}"> <apex:tab label="Field Sections"> <apex:tabpanel switchType="client" tabClass="activeTab" inactiveTabClass="inactiveTab"> <apex:tab label="Relevant Personnel" name="Relevant_Personnel" id="ReleventPersonneltabFieldSet"> <apex:include pageName="Opp_ReleventPersonnelFieldSet"/> </apex:tab> <apex:tab label="Win/Loss Info" name="Win_Loss_Info" id="Opp_WinLossInfo"> <apex:include pageName="Opp_WinLossInfo"/> </apex:tab> </apex:tabPanel> </apex:tab> <apex:tab label="Opportunity Team" name="Opportunity Team" id="TabTeam" rendered="{!(Opportunity.StageName <> 'Finalist')}"> <apex:relatedList subject="{!Opportunity}" list="OpportunityTeamMembers" /> </apex:tab> <!--<apex:tab label="Opportunities" name="Opportunities" id="tabOpp"> <apex:relatedList subject="{!Opportunity}" list="opportunities" /> </apex:tab>--> <apex:tab label="Strategic Account Plan" name="StrategicAccountPlan" id="tabSAPs"> <apex:relatedList subject="{!Opportunity}" list="Strategic_Account_Plans__r" /> </apex:tab> <apex:tab label="STAR Plan" name="STAR_Plan" id="STAR_Plan"> <apex:include pageName="Opp_Rel_SAPDetails"/> </apex:tab> <apex:tab label="Services Support Requests" name="Services Support Requests" id="tabSSRs"> <apex:relatedList subject="{!Opportunity}" list="Request_Services_Support__r" /> </apex:tab> <apex:tab label="Notes and Attachments" name="NotesAndAttachments" id="tabNoteAtt"> <apex:relatedList subject="{!Opportunity}" list="NotesAndAttachments" /> </apex:tab> </apex:tabPanel> </apex:page>