-
Salesforce Visualforce Page - Disable previous date in calendar
VF Page-
<apex:page showHeader="false" controller="Test4">
<head>
<apex:stylesheet value="https://code.jquery.com/ui/1.10.3/themes/smoothness/jquery-ui.css" />
<apex:includeScript value="https://code.jquery.com/jquery-1.9.1.js" />
<apex:includeScript value="https://code.jquery.com/ui/1.10.3/jquery-ui.js" />
</head><script>
var today = new Date();
$("#datepicker").datepicker({
changeMonth: true,
changeYear: true,
minDate: today
});
</script>
<apex:form >
<apex:pageBlock >
<apex:selectList value="{!selectId}" size="1">
<apex:selectOptions value="{!displayOptions}"></apex:selectOptions>
<apex:actionSupport event="onchange" action="{!changeDateRange}" reRender="calender"/>
</apex:selectList>
<input type="text" id="datepicker"/>
</apex:pageBlock>
</apex:form>
</apex:page>Controller-
public class Test4 {
public List<selectoption> displayOptions { get; set; }
public String selectId { get; set; }
public Date myDate {get;set;}public PageReference changeDateRange() {
myDate = Date.today();
if(selectId.equals('10')){
myDate = myDate.addDays(10);
} else if(selectId.equals('20')){
myDate = myDate.addDays(20);
}
return null;
}public test4()
{
myDate = Date.today();
displayOptions =new List<selectoption>();
displayOptions.add(new selectoption('none','-select-'));
displayOptions.add(new selectoption('10','Next 10 Days'));
displayOptions.add(new selectoption('20','Next 20 Days'));
}}
I want to disable previous date in calendar but its not working.
Log In to reply.
Popular Salesforce Blogs

Salesforce CPQ Quickstart – Implement Salesforce CPQ in Weeks, not Months!
“Quickstart” is a term that has been casually used in the technology space to project a sense of urgency and action, especially in relation to…

Leverage Salesforce Integration Services to Retain Valuable Customers
We all have heard that integrating Salesforce with other applications provides organizations much greater operational visibility and access to unknown resources. It offers innovative products…

Top Salesforce Spring '23 Release Features
The wait is finally over. Salesforce Spring '23 release features are here and we cannot wait to discover the outstanding releases. As we know by…
Popular Salesforce Videos
Salesforce Connections 2018 Keynote - Ch. 4: U.S. Bank Is A Trailblazer
Salesforce Connections 2018 Keynote – Ch. 1: Corporate Positioning Salesforce Connections 2018 Keynote – Ch. 2: Ticketmaster Is A Trailblazer Salesforce Connections 2018 Keynote –…
Sculptor CPQ for Salesforce
Sculptor CPQ (Configure-Price-Quote) for Salesforce CRM-based businesses allows to reduce the length of the sales cycle and generate quotes 2X faster. Smart and intuitive product…
How to Become Salesforce Developer | Salesforce For Beginners
In this how-to become Salesforce developer video, you will be learning what is Salesforce, the fundamentals of Salesforce, how to become a Salesforce developer, how…