8.4.2: How to detect the date widget change?

Permalink
$fdth = $app->make('helper/form/date_time');
echo $fdth->date('date', $today);

The date is appended to a hidden input which doesn't trigger the change event. Is there any way to detect the date change?

I see the widget may take a $datePickerOptions, I guess it should accept the jQuery-UI timepicker 'onSelect' option. But how can I combine jQ in PHP?

linuxoid
 
JohntheFish replied on at Permalink Reply
JohntheFish
See https://api.jqueryui.com/datepicker/...

Browser support for <input type="date"> is now very good, so unless you need backward compatibility, that provides an alternative
https://developer.mozilla.org/en-US/docs/Web/HTML/Element/input/date...
linuxoid replied on at Permalink Reply
linuxoid
The date type input behavior is different to the concrete's and it's ugly, I'll leave it for a back-up. I'd rather get the core widget to work.

I'm using the helper. How can I add the 'onSelect' option to the helper?
linuxoid replied on at Permalink Reply
linuxoid
I got it:
var date_pub = $('#date_pub');
date_pub.datepicker("option", "onSelect", myFunction);
function myFunction() {
...
});
linuxoid replied on at Permalink Reply
linuxoid
Although the above works, I'm wondering how the 'onSelect' option can be done in the $datePickerOptions which is a more elegant way I think and that should be the way to do that. Any ideas?