Keep the field text id ready from the input code line in order to map it to the required past date selection validation ie. Selected Date <= Today
- <input type="text" class="input-field datefilingcls hasDatepicker" id="txt_dateofintimation" name="field1" readonly="">
Create a JQ function representing link to that field's id “txt_dateofintimation” for selecting only past dates and the max date is today only with a gap of 3 months.
- $(document).ready(function() {
- loadBlankPage();
- var dateToday = new Date();
- $("#txt_dateofintimation").datepicker({
- numberOfMonths: 3,
- showButtonPanel: true,
- maxDate: dateToday
- });
- })
Go to that site's page and start filling in the details.
Here is the validation pop up for Date field to be selected.
Current date is 17th May 2017 as shown below in the bottom bar and the function also allows us to select the dates before today as per the validation requirement.