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

question on connection callback declaration

Expand Messages
  • portalparts
    When looking at the examples for the Connection Manager, there are several ways in which the callback function is defined. I am not totally clear on the
    Message 1 of 2 , Jul 29, 2006
    • 0 Attachment
      When looking at the examples for the Connection Manager, there are
      several ways in which the callback function is defined. I am not
      totally clear on the purpose and sytnax of the 'argument' property.

      var callback =
      {
      success: handleSuccess,
      failure: handleFailure,
      argument: { foo:"foo", bar:"bar" },
      timeout: 5000
      };

      I've seen it:
      i) not defined at all
      ii) argument: {'foo', 'bar'},
      iii) argument: { foo:"foo", bar:"bar" },

      I read from the docs, the argument property is: The user-defined
      argument or arguments as defined in the callback object. The
      callback object is often just referencing 1 parm, the object as in
      var handleSuccess = function(o) and don't see the arguments being
      referenced so I'm not following the purpose of this property.

      Now, is this property being used to indicate the form being posted
      as 2 fields and in case of example (iii) above setting defaults for
      these 2 fields and using just dummy names for the fields as in foo
      and bar?

      What is the benfit/purpose of this and what do you do if there are
      20 fields on the form being posted?
    • portalparts
      ... for ... Been doing some more testing and discovery and I think this property is used more when when the return results are specific arguments and not a
      Message 2 of 2 , Jul 29, 2006
      • 0 Attachment
        --- In ydn-javascript@yahoogroups.com, "portalparts"
        <portalparts@...> wrote:
        >
        > When looking at the examples for the Connection Manager, there are
        > several ways in which the callback function is defined. I am not
        > totally clear on the purpose and sytnax of the 'argument' property.
        >
        > var callback =
        > {
        > success: handleSuccess,
        > failure: handleFailure,
        > argument: { foo:"foo", bar:"bar" },
        > timeout: 5000
        > };
        >
        > I've seen it:
        > i) not defined at all
        > ii) argument: {'foo', 'bar'},
        > iii) argument: { foo:"foo", bar:"bar" },
        >
        > I read from the docs, the argument property is: The user-defined
        > argument or arguments as defined in the callback object. The
        > callback object is often just referencing 1 parm, the object as in
        > var handleSuccess = function(o) and don't see the arguments being
        > referenced so I'm not following the purpose of this property.
        >
        > Now, is this property being used to indicate the form being posted
        > as 2 fields and in case of example (iii) above setting defaults
        for
        > these 2 fields and using just dummy names for the fields as in foo
        > and bar?
        >
        > What is the benfit/purpose of this and what do you do if there are
        > 20 fields on the form being posted?
        >

        Been doing some more testing and discovery and I think this property
        is used more when when the return results are specific arguments and
        not a chunk of HTML or updated set of form fields. It lets you set
        the defaults and expected arguments in the callback - as the docs
        state.
      Your message has been successfully submitted and would be delivered to recipients shortly.