-
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
Strategies to Boost Nonprofit's Efficiency with Tableau CRM | Salesforce
With the Salesforce technology, known as Tableau CRM users can make data-driven decisions while saving a ton of time and money thanks to AI features…
Salesforce Mobile App Development: Integrating Third-Party Apps and Services
Introduction Productivity while on the road is essential in today's hectic work environment. In order to empower its users, Salesforce, a top customer relationship management…
Salesforce Health Cloud for Insurance: Optimize Operations
Insurance companies are constantly looking for ways to streamline their operations and provide better customer service. One solution that has gained significant traction in the…
Popular Salesforce Videos
How Do All Salesforce Products Come Together
The products of Salesforce run completely in the cloud. Therefore, the companies don’t need to fret about costly maintenance and setup charges. Additionally, cloud technology…
Salesforce Developer Tools and Productivity
Kevin Poorman shows how you can use Salesforce Developer Tools and how you can unlock developer productivity. Watch this video to learn more.
What is a Salesforce Admin?
Salesforce administrators are the gatekeepers of their employer's sales and marketing data. They create each user account and determine the proper level of access based…