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

Re: [ydn-javascript] YUI buttons layout with AJAX request

Expand Messages
  • Pieter Thoma
    Hi, thanks for the reply, I ll try to set up a demo showing the problem. But, yes indeed, I have a button which does something like onclick=
    Message 1 of 3 , Apr 1, 2008
    • 0 Attachment
      Hi,

      thanks for the reply, I'll try to set up a demo showing the problem.

      But, yes indeed, I have a button which does something like onclick=

      onAJAXResponse(data) {

        contentElement.innerHTML = data;

        var oSubmitButton1 = new YAHOO.widget.Button("add-initial-aliquots-submit-button", { type:"submit" });
       
      }

      Regards,

      Pieter

      On Tue, Apr 1, 2008 at 11:40 PM, Todd Kloots <kloots@...> wrote:
      Pieter -

      Can you clarify the order of operations for creating your button? Is the AJAX call you are making returning the HTML that will be used to create the Button?  If so, you should be creating the Button inside the scope of the callback for the AJAX request.  For example, some pseudo code:

      onAJAXResponse(data) {

        contentElement.innerHTML = data;

        var oSubmitButton1 = new YAHOO.widget.Button("add-initial-aliquots-submit-button", { type:"submit" });

      }

      Better yet - can you provide a URL to an example that illustrates how this comes together?  That'll make it much easier to help you debug.

      - Todd

      pieter.thoma wrote:

      Hi,

      I'm having a small problem when using YUI buttons and doing an AJAX
      request. I have some dynamic content which gets into a span or div
      using AJAX. The HTML is well returned, but the initialisation of the
      javascript code to make the hover of the button look well doesn't seem
      to work.

      I changed this:

      YAHOO.example.init = function () {
      YAHOO.util.Event.onContentReady("add-initial-aliquots", function () {
      var oSubmitButton1 = new
      YAHOO.widget.Button("add-initial-aliquots-submit-button", { type:
      "submit" });
      });
      } ();

      to:
      function click() {
      //ajax request
      YAHOO.util.Event.onContentReady("add-initial-aliquots", function () {
      var oSubmitButton1 = new
      YAHOO.widget.Button("add-initial-aliquots-submit-button", { type:
      "submit" });
      });

      But it doesn't seem to work.

      What am I doing wrong?
      } ();




    Your message has been successfully submitted and would be delivered to recipients shortly.