-
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
AWS Cloud Basics | Salesforce Trailhead Guide
In this blog, we will be taking a look at the topic of AWS Cloud. As we all know Cloud computing is the on-demand provision…
Salesforce Marketing Cloud Connect
Marketing Cloud Connect allows Salesforce users to leverage the advanced marketing power of the Marketing Cloud and the customer relationship tools in Sales and Service…
Benefits of Salesforce CRM for Insurance Company
In today’s dynamic market, insurance companies need more than just adaptability to stay competitive – they must innovate for long-term success. A powerful tool in…
Popular Salesforce Videos
How To Change Opportunity Stages In Salesforce
If you're finding that you need to change the stages of opportunity in Salesforce, don't worry, it's easy to do. In this video, Gary Smith…
Salesforce CRM Services offered by Melonleaf Consulting
Melonleaf Consulting offers customized and configured Salesforce CRM Solutions and Services that can revolutionize your business. Experience the power of top-notch and highly effective Salesforce…
Introduction to Salesforce Einstein OCR
In this session, we will learn about Einstein OCR and Create/Update Leads and Contacts using Business Cards. Let’s welcome an amazing #Summer20 release gem –…