CORRECTION title should say updating to views 2.9.1
https://toolset.com/forums/topic/post-date-and-close-date-limit-range-to-28-days/
Hi,
Above is the previous ticket which was resolved perfectly - however, since upgrading to Views 2.9.1 the code below is no longer working.
jQuery(window).bind("cred_form_ready", function() {
var ts_date_handler = function( dateIsEmpty, datepickerObj ){
var selected = datepickerObj.selectedYear + "/" + (datepickerObj.selectedMonth + 1) + "/" + datepickerObj.selectedDay;
var selectedDate = new Date( selected );
var limitDate = new Date();
limitDate.setDate(selectedDate.getDate() + 28);
$('input[name="wpcf-job-closing-date[display-only]"]').datepicker('option', {minDate: selectedDate, maxDate: limitDate });
}
$('input[name="wpcf-job-post-date[display-only]"]').datepicker('option', {minDate: 0,maxDate: 28, onClose: ts_date_handler } );
});
The page where this code is in action is on hidden link (you will need to be logged in to see it properly - I have supplied site access details)
Hi Nigel - I swapped $ for jQuery and this has fixed the issue.
My issue is resolved now. Thank you!
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Hi Adam
Do you have a staging site suitable for some routine testing?
I noticed in the browser console a JS error originating from the autoptimize plugin, but if I disable that there are 500 errors for ajax requests also visible in the browser.
I'd like to do some testing switching versions of Views and disabling caching plugins and similar, but didn't want to do that on your live site...
Nigel
Supporter
Languages:
English (English )
Spanish (Español )
Timezone:
Europe/London (GMT+00:00)
Sorry, I missed your update while hopping across to a meeting, glad that it is resolved.