YUI recommends YUI3.
YUI 2 has been deprecated since 2011. This site acts as an archive for files and documentation.
This documentation is no longer maintained.
The Calendar control exposes a number of CustomEvents, so that applications can listen for and react to interesting moments in the Calendar's operation. This example demonstrates how to listen for the select and deselect events, which are fired whenever a date in the Calendar is selected or deselected.
Calendar provides several events to which an application can subscribe in order to react easily to changes in the state of the Calendar. The events provided are:
The events are each defined by YAHOO.util.CustomEvent, and are subscribed to using the subscribe method of CustomEvent. In this example, we will display a message each time a date is selected or deselected. The selectEvent and deselectEvent events will fire when selections and deselections are made via user interaction (eg, when a user clicks to select a date) or programatically (eg., if a script on the page executes the select method to select a date).
The dateToLocaleString
function used to generate the messages demonstrates how you can use the locale configuration properties for Calendar when creating string representations of dates
Note: You are viewing this example in debug mode with logging enabled. This can significantly slow performance.
All YUI 2.x users should review the YUI 2.8.2 security bulletin, which discusses a vulnerability present in YUI 2.4.0-2.8.1.
Copyright © 2013 Yahoo! Inc. All rights reserved.