Calendars : Setting DateTo's latest date 5 days after DateFrom

shiluba 23 Oct, 2020
Hi,
With CFv6, I'm trying to make a calendar (#DateFrom) change the latest possible date of another one (#DateTo). In fact #DateTo should not be more than 5 days after #DateFrom.
So far I can not get a javascript function to work by using the "Events" tabs. Here are my current settings into #DateFrom ...
Triggering event : Change
Triggered action(s) : Function
Possible values : date_change
Affected elements : #DateTo
... but the function is not triggered when picking a start date. Not even with a simple ...
function date_change(){
console.log("date_change");
}
What am I missing ?

I tried another approach : I made a JQuery function starting with :
$('#DateFrom').on("blur",function(){...
From there, I can set the attribute "data-maxdate" of #DateTo with the proper value :
$("#DateTo").attr("data-maxdate", DateTo_string); 
... DateTo_string matches with the real format of #DateTo (YYYY-MM-DD)
But then, only the attribute is changed and #DateTo still allows selecting dates that are more than 5 days after #DateFrom.

I tried to use JQuery's datepicker also :
$("#DateTo").datepicker( "option", "maxDate", DT ); 
It throws back no error, but it changes nothing to #DateTo (neither its latest date nor its "data-maxdate" attribute).

Help please ! How can I make that work in CFv6 ?
You need to login to be able to post a reply.