-
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 Development Companies for Scalable Growth
In today’s competitive digital landscape, businesses need more than just a CRM, they need a flexible, intelligent platform that adapts to their processes and grows…
Salesforce Marketing Cloud Summer'21 Top Features
With Marketing cloud, send your customer the right message at the right time on the right platform and increase your reach. Get a panoramic view…
Leverage our Salesforce Customization Services to Reach Your Business Goals Faster
When it comes to practical CRM, nothing can contend with Salesforce. With whooping revenue of $5.38 billion in the 2021 fiscal year, this CRM management…
Popular Salesforce Videos
Salesforce Developer Training Videos For Beginners | Salesforce Training Videos | Edureka
This Salesforce developer training video will give you an introduction to the development aspects of Salesforce. You will learn how Visualforce pages are created by…
Getting Started With Business Analysis | Scrum Development Model | Salesforce Tutorial
Learn all about AGILE software development and the scrum development model. 1. Introduction To AGILE Get a brief definition of AGILE and its different modules.…
Salesforce Tutorial - Data Loader Installation On Windows - with Zulu Open JDK
Data Loader is utility to perform bulk database operation. Recently Salesforce has changed the way data loader need to be install. I explain end to…