Loading ...
Sorry, an error occurred while loading the content.

387Re: how do I access events in the basic Calendar?

Expand Messages
  • casiewelch
    Mar 3, 2006
    • 0 Attachment
      Okay, here is what I don't understand, probably because I'm pretty
      new to Javascript, although I have been getting the hang of the AJAX
      stuff no problem, and making some functional stuff.

      Anyway, I have some confusion here, and although I know my problems
      may seem mundane, a little clarification would greatly assist me. I
      apologize for being a pain in the ass, but believe me, I am trying
      very hard to figure this stuff out on my own - I'm not just bugging
      you folks for no reason.

      My basic problem is that I don't understand how to listen to the
      Calendar's default events. If I listen to an event like this:

      function init() {
      cal1 = new YAHOO.widget.Calendar("cal1","cal1Container");
      YAHOO.util.Event.addListener(cal1.id, "click", fnTest);

      function fnTest () {

      It works no problem - when I click the calendar, the event fires.
      This I understand.

      What I don't understand is how to get to other events, like when the
      I select a cell in the calendar. In the calendar's documentation it

      void onSelect
      Event executed when a date is selected in the calendar widget.

      When I modify the code above like so:

      YAHOO.util.Event.addListener(cal1.id, "onSelect", fnTest);

      It doesn't work.

      YAHOO.util.Event.addListener(cal1.id, "select", fnTest);

      Doesn't work either.

      So my question is, how do I add listeners for these default events?

      And if someone has the time, my other question is: how do I know
      what the name of the event is? To add a listener to the click
      event, the syntax is:

      YAHOO.util.Event.addListener(cal1.id, "click", fnTest);

      As far as I know, a click event in Javascript is normally
      called "onClick". So why isn't the syntax:

      YAHOO.util.Event.addListener(cal1.id, "onClick", fnTest); ?

      It was only by trial and error that I was able to get this right.
      Is there a resource of some kind where I can see a list of actual
      event names (like onClick, onSelect) and their corresponding Yahoo
      event listener shortform (like click)?

      Again, I humbly apologize for my ignorance and lack of expertise -
      with luck, perserverance and some help from you folks, these
      deficiencies will be temporary.



      P.S. If any of you have some sample code I could take a look at that
      would clear up this for me, you can send it to adrianduyzer AT
      gmail.com (this yahoo account belongs to my wife).

      --- In ydn-javascript@yahoogroups.com, "casiewelch" <casiewelch@...>
      > Hi there folks -
      > I like the Calendar widget, nice work. Adds a lot of
      > functionality. However, I am banging my head against the wall
      > trying to figure out how to set up events for the basic Calendar.
      > The documentation states that Calendar inherits event-related
      > methods from YAHOO.widget.Calendar_Core such as wireDefaultEvents.
      > The documentation states that wireDefaultEvents "Wires the local
      > events for the Calendar, including cell selection, hover, and
      > default navigation that is used for moving back and forth between
      > calendar pages."
      > However, there is no list of events, their names, or (seemingly)
      > documentation on how to listen to or access any of these events.
      > Could someone please enlighten me as to how to use the default
      > events associated with the basic Calendar widget? An example that
      > triggered an alert box when a cell is selected in the Calendar
      > be ideal.
      > Regards,
      > -Adrian
    • Show all 3 messages in this topic