1

I am using Date popup module for selecting a date in a registration form. Is it possible to fire an event on date select?

3
  • What kind of an event? Do you want to trigger an ajax form event or a custom JS/jQuery event? Commented May 22, 2015 at 9:42
  • 1
    Drupal's Date module uses a jQuery UI Datepicker, see the doc for the select event
    – Ben
    Commented May 22, 2015 at 9:44
  • A custom function.
    – Anamika
    Commented May 25, 2015 at 11:24

1 Answer 1

1

For Drupal 7, the datepicker is indeed likely to be the one from jQuery UI, and since you may not know in your own javascript if date pickers have been initialized yet, an easy way to trigger your "custom function" is to listen for selection on any date picker on the page.

  jQuery.datepicker.setDefaults({
    onSelect: function () {
      console.log('date selected');
    }
  });

Refer to the jQuery UI onSelect documentation for more information.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.