-
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
Learn Salesforce Einstein – Chapter 2 (AI Buddy Installation)
AI Buddy Installation 1. Login in the org, where you want to install the App. 2. Go to Download Page and click on the latest…
NorCal Dreamin’ 2019 Wraps Up! What Did Algoworks Witness?
A Salesforce community event led by the Salesforce community, NorCal Dreamin’ 2019 was a huge success! We had a blast while interacting with the amazing…
How to Reach Better User Experience of a Salesforce App with a Webix-based Data Grid
Each growing business should continuously evolve since customers are becoming more demanding every day. As a result, software solutions are becoming obsolete very fast. The…
Popular Salesforce Videos
Salesforce Marketing Cloud Connect
We explore the key benefits of Marketing Cloud Connect as the start of a four-part series surveying the power, flexibility, and personalization that can be…
Ask Me Anything with Salesforce Developers | Lightning Web Components
Join experts Mohith Shrivastava and Greg Whitworth for our monthly feature Ask Me Anything! This 1-hour session on Lightning Web Components is your chance to…
Salesforce Financial Services Cloud Implementation Guide
You’ve decided to use Salesforce Financial Services Cloud but where do you begin? How can you utilize Salesforce to track all your customer interactions and…