-
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
Defining Salesforce Marketing Cloud Engagement and Why It's Crucial For Businesses
Salesforce Marketing Cloud Engagement previously known as Marketing Cloud Email Studio can play a critical part in a company's marketing strategy, helping develop client connections…
How to Fast-Track Your Case Resolution With Email to Case Advance?
Customers always need help. And for an enterprise to find success, it’s important to solve its queries and provide the required support. Email is one…
Lead Assignment to the User in a Round Robin fashion | Salesforce Tutorial
Balance your team's workload by automatically assigning new leads to each user. A round-robin assignment means that all new leads will be assigned the same…
Popular Salesforce Videos
Salesforce Pardot Basics - A Comprehensive Guide (2021)
In this short video, we will cover the basics of Salesforce Pardot Pardot by Salesforce is a demand generation and marketing management tool by Salesforce.…
Everything New in Salesforce Developer Tools
Your productivity starts and ends with the tools you use. Learn how Salesforce Developer Tooling can help you collaborate more effectively with your whole team.…
Apex Performance Tips and Tricks | Salesforce Video Guide
Watch this video to learn all about Apex Performance: • What do we mean by performance? • How do we measure performance? • Loop Performance…