-
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
Permission Sets in Salesforce - Get Started Guide
Introduction Permission sets are a collection of settings and permissions that allow the users to have additional access, which they have already got from their…
Small business’s customer service dilemma: Salesforce Desk.com or Service Cloud Essentials?
Browsing through Salesforce offerings, small businesses may feel as if they were at a huge, noisy, exotic market somewhere in Asia: there’s so much to…
Opportunity Line Items in Salesforce - Learn Here
What are Opportunity Line Items? The Products connected to an Opportunity are called OpportunityLineItem. There are many different things that a business might sell. These…
Popular Salesforce Videos
How to Configure Lightning Sales Path Salesforce
In this video, Pratima provides a detailed demo on how to configure the Lightning Sales Path, the Lead path for Standard and custom objects, the…
Web to Case Functionality in Salesforce | All You Need to Know
This video discusses the functionality of Web to Case in Salesforce, which allows website users to submit inquiries or information that can be converted into…
Salesforce training video for beginners
Salesforce is an innovative tool that can be very powerful when used properly. That’s why it’s important to find effective and trustworthy ways to learn…