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

dynamically setting callback

Expand Messages
  • Ken Loomis
    Hello: I m stuck. I have a dialog and I want to change the connection manager callback in the handleSuccess function. How can I do that? This is what I have
    Message 1 of 2 , Aug 1, 2008
    • 0 Attachment
      Hello:

      I'm stuck. I have a dialog and I want to change the connection manager
      callback in the handleSuccess function.
      How can I do that? This is what I have tried.

      var ITR = function() {
      var successRoutine;
      var dialogCallback;
      return {
      'getDialogSuccessRoutine': function() {
      return successRoutine;
      },
      'getDialogCallback': function() {
      return dialogCallback;
      },
      'setDialogSuccessRoutine': function(success) {
      successRoutine = success;
      },
      'setDialogCallback': function(theCallback) {
      dialogCallback = theCallback;
      }
      };
      }();

      var handleEditDialogSuccess = function(o) {
      var postdata = ITR.getDialogSuccessRoutine();
      var callbackFunction = ITR.getDialogCallback();

      YAHOO.util.Connect.asyncRequest('POST','ajax.php',callbackFunction,postdata);
      };

      I get the post data OK, but I can't get the callback. How do I pass a
      function around?

      Thanks,

      Ken
    • Satyen Desai
      Hi Ken, There seems to be a piece missing here. Where do ITR.setDialogSuccessRoutine() and ITR.setDialogCallback() get invoked and what s passed in to these
      Message 2 of 2 , Aug 7, 2008
      • 0 Attachment

        Hi Ken,

        There seems to be a piece missing here. Where do ITR.setDialogSuccessRoutine() and ITR.setDialogCallback() get invoked and what’s passed in to these methods?

         

        If ITR.getDialogCallback() is not returning a “valid” callback object, which you can use as the callback parameter to asyncRequest, then I can only imagine that it’s not being set correctly to begin with.

         

        NOTE: callbackFunction should not really be a function, but an object with a success property pointing to a function.

         

        Regards,

        Satyen

         


        From: ydn-javascript@yahoogroups.com [mailto: ydn-javascript@yahoogroups.com ] On Behalf Of Ken Loomis
        Sent: Friday, August 01, 2008 7:42 PM
        To: ydn-javascript@yahoogroups.com
        Subject: [ydn-javascript] dynamically setting callback

         

        Hello:

        I'm stuck. I have a dialog and I want to change the connection manager
        callback in the handleSuccess function.
        How can I do that? This is what I have tried.

        var ITR = function() {
        var successRoutine;
        var dialogCallback;
        return {
        'getDialogSuccessRo utine': function() {
        return successRoutine;
        },
        'getDialogCallback' : function() {
        return dialogCallback;
        },
        'setDialogSuccessRo utine': function(success) {
        successRoutine = success;
        },
        'setDialogCallback' : function(theCallbac k) {
        dialogCallback = theCallback;
        }
        };
        }();

        var handleEditDialogSuc cess = function(o) {
        var postdata = ITR.getDialogSucces sRoutine( );
        var callbackFunction = ITR.getDialogCallba ck();

        YAHOO.util.Connect. asyncRequest( 'POST','ajax. php',callbackFun ction,postdata) ;
        };

        I get the post data OK, but I can't get the callback. How do I pass a
        function around?

        Thanks,

        Ken

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