-
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
Can You Really Learn Salesforce Marketing Cloud in 30 Days?
If you’re serious about taking your marketing career to the next level, mastering Salesforce Marketing Cloud could be a game-changer. But with so many features,…
Segments of Salesforce Data Cloud
Salesforce Data Cloud is a powerful platform that provides businesses with actionable data insights. Its features and architecture meet diverse business needs, making it a…
A Guide to Utilizing the Salesforce Customer Portal in Academia
Educational institutions have undergone significant changes over the years. Entering the early 2000s, these institutions gradually embraced technology by introducing advanced computer labs that allowed…
Popular Salesforce Videos
How to Use Customer 360 | Salesforce
See how Salesforce Customer 360, our entire portfolio of technology, unites your team with company data on one integrated CRM platform, delivering the personal experiences…
Exploring Salesforce composite Resources | Composite API
Exploring Salesforce composite Resources-- 0:00 Introduction 1:30 What is Composite Resources? 2:00 Composite Resources consists of 2:25 Composite request body 5:30 Composite request response 6:33…
How to Create Bulk Custom Fields in Salesforce using BOFC App | Salesforce | BOFC | AppExchange
Want to perform multiple operations? This quick video walks you through how to create mass custom fields of any type (Master Detail, Lookup, Formula, Primitive…