-
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
How To Create A Lightning Web Component | The Salesforce Developer Guide
For this, you first need to have Visual Studio Code in your system. If you don’t have that then first install it. After that, you…
Salesforce Ant Migration Ubuntu
Copying data is a very powerful tool. We all have done that in our High schools, copying assignments. It also plays a significant role in…
Image Uploader: An Amazing Lightning Component
This is the documentation to create a lightning component to upload pictures to a standard salesforce object which in this particular case is the Products.…
Popular Salesforce Videos
Create Customers for Life with the Loyal Program in Salesforce
Ever thought about how you can retain your customers in this cutthroat competition in this growing market? A customer loyalty program is one of the…
Campaign Management in Salesforce | Campaigns in Salesforce
Learn all about campaign management in Salesforce. Also, get a glimpse of how to create a campaign, add campaign members, how to use campaigns to…
Salesforce Administrator and Developer Training | Salesforce Training Videos
This Salesforce Training video is a demo of how the live online instructor-led classes take place after you enroll for the Online Classroom. All training…