-
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
Apex Integration in Salesforce - The Developer Guide
This article closes the arrangement, Learning Salesforce Integration, which subtleties different joining choices with Salesforce. It covers utilizing Apex for building incorporations, which turns into…
Salesforce to Salesforce SSO using Authentication Provider
As many users work on multiple Salesforce instances and it is very difficult to memorize password for each, therefore we connect multiple Orgs together so…
Salesforce Web To Lead - All You Need to Know About
What is Web to Lead? Salesforce web to lead is a tool that allows you to collect leads from your website and save them in…
Popular Salesforce Videos
Salesforce Vaccine Management | Salesforce Vaccine Cloud
Leveraging technology to manage vaccines has become increasingly important. Salesforce is investing in the public sector to aid the efforts to combat the spread of…
Salesforce on Salesforce: How Salesforce Uses Trailhead to Drive Enablement
With Trailhead, Salesforce is transforming the learning experience for our employees at every step of their career journey. Join us to learn tips, tricks and…
Write Tableau CRM Data to Salesforce Objects
Use Tableau to blend Salesforce data from across the Customer 360 platform with your other business data for increased visibility and a deeper understanding of…