I want to throw an error message on a popup, when the datepicker chooses a future date(other than today's date).
Please how can I do it?
Visualforce code:
<apex:page standardcontroller="RELVSSubmission__c"
extensions="RELVSRenewalController" showheader="false" sidebar="false">
<apex:form>
<apex:messages/>
<apex:pageblock id="close">
<apex:pageblocksection title="Legal Name Change" columns="1">
<apex:pageblocktable value="{!aAccount}" var="item" id="editAccountName">
<apex:column headervalue="Proposed Legal Name">
<apex:inputtext value="{!UpdatedLegalName}"/>
</apex:column>
<apex:column headervalue="Reason for Name Change">
<apex:inputtextarea value="{!LegalNameChangeReason}"/>
</apex:column>
<apex:column headervalue="Date the Name was Changed">
<apex:inputfield value="{!item.RELVSLegalNameChangeDate__c}" />
</apex:column>
</apex:pageblocktable>
</apex:pageblockSection>
<apex:pageblockbuttons location="bottom" >
<apex:commandButton value="Save" action="{!UpdateAccountLegalName}" />
<apex:commandbutton value="Cancel" onclick="window.close()" />
</apex:pageblockbuttons>
</apex:pageBlock>
</apex:form>
</apex:page>
Controller:
public Date LegalNameChangeDate {get; set;}
public PageReference UpdateAccountLegalName(){
if(aAccount.Name != null){
aAccount.Name = UpdatedLegalName;
aAccount.REL_VS_LegalNameChangeReason__c = LegalNameChangeReason;
aAccount.REL_VS_LegalNameChangeDate__c = LegalNameChangeDate;
upsert aAccount;
partialSave();
}
return new PageReference('javascript:window.opener.location.reload();window.self.close();');
}
Please help!