Adding a custom datepicker to a form
The standard datepicker that is rendered when an <apex:inputField />
component is bound to an sObject
field of type Date
or DateTime
has a limited range of years available, as shown in the following screenshot:
The range of years presented is suitable for an opportunity close date, but it is unsuitable for capturing a contact's date of birth. One option to improve this is to add some JavaScript to the page that alters the datepicker year range, but this entails a risk as it relies on the standard datepicker code to remain the same.
In this recipe, we will integrate a third-party JavaScript datepicker with a Visualforce ...
Get Visualforce Development Cookbook - Second Edition now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.