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

Re: [ydn-javascript] Problems with event handling using YUI buttons

Expand Messages
  • Todd Kloots
    uniquefer - As a point of information: using YAHOO.util.Event.addListener to add an event listener to a Button instance is not recommended. You should use
    Message 1 of 3 , Jul 29, 2008
    • 0 Attachment
      "uniquefer" -

      As a point of information: using YAHOO.util.Event.addListener to add an
      event listener to a Button instance is not recommended. You should use
      Button's "addListener" method (or "on" for short).

      If you are still having problems registering your invokeCalendar method
      using Button's "addListener" method, send me a URL to the page that
      exhibits the problem and I will take a look.

      Regards,
      Todd


      Dean Jennings wrote:
      >
      > Try YAHOO.util.event.addListener( pickDateButton,"click",invokeCalendar);
      >
      > uniquefer wrote:
      > >
      > > Hi fellows,
      > >
      > > I am new to the YUI library and I'm building my first webapp using the
      > > YUI library.
      > >
      > > I have some problems in registering a event handler to a button.
      > >
      > > I use a button tag and the a javascript function to define the button
      > >
      > > Here is my code
      > >
      > > <span id="pickDateButtonContainer" class="yui-button">
      > > <button type="button">Pick the date</button>
      > > </span>
      > >
      > > var pickDateButton = new YAHOO.widget.Button(
      > > "pickDateButtonContainer",
      > > {
      > > type: "push"
      > >
      > > }
      > > );
      > >
      > > and I want to invoke the function "invokeCalendar" when the button is
      > > pressed. Here is the JS code that I used
      > >
      > > pickDateButton.addListener("click", invokeCalendar);
      > >
      > > However, when I press the button, nothing happened.. and I got this
      > > error message from the firefox JS error console.
      > >
      > > Error: this._events is undefined Line: 588
      > > (I'm using the source rather than the compressed js source file).
      > >
      > > Anyone can help???
      > >
      > >
      >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.