A commonly requested feature for the popup calendar is to be able to pop it open via a button. Unfortunately I haven’t had time to add this feature directly into the module but today @gdanko popped into #yui on irc.freenode.net and was willing to help test the small code changes required to make sure that this would work.

Until I am able to add support into the module, simply copy and paste the following code before the first instance of Y.PopupCalendar or Y.PopupCalendarGroup.

Y.PopupCalendar.prototype._bindEvents = function() {
  Y.log('_bindEvents', 'info', this.name);

  var input = this.get('input');

  if (input.get('type') === 'text') {
      input.on('focus', this.showCalendar, this);
  } else {
      input.on('click', this.showCalendar, this);

  input.on('keydown', this.testKey, this);
  this.on('selectionChange', this._emitDate, this);
  this.after('autoFocusOnFieldFocusChange', this.setHideOn, this);

And that’s it. You can now supply most elements to show the calendar. If you are having any issues implementing this patch feel free to comment below, mention me @fromanegg or pop into #yui on irc.freenode.net