Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Incomplete
    • Affects Version/s: 2.0.2
    • Fix Version/s: unscheduled
    • Component/s: ajax
    • Labels:
      None
    • Environment:

      Operating System: All
      Platform: All

    • Issuezilla Id:
      1,494

      Description

      Simple example:
      <h:commandLink value="Click me">
      <f:ajax onevent="callback" />
      </h:commandLink>

      JS is defined as:
      callback = function()
      {
      alert('Moin);
      }

      Rendered HTML:
      <a onclick="mojarra.ab(this,event,'action',0,0,

      {'onevent':callback}

      );return
      false" href="#" id="j_idt12" name="j_idt12">Click me</a>

      When I click the link, ajax request is triggered (OK), BUT I get three alert()
      calls saying "undefined" ...

      ==> version: 2.0.2-b10

        Activity

        Hide
        mwessendorf added a comment -

        the callback should be called ONLY once;
        however it is called 3times, which is wrong.

        So I reopened this ticket.

        Show
        mwessendorf added a comment - the callback should be called ONLY once; however it is called 3times, which is wrong. So I reopened this ticket.
        Hide
        rogerk added a comment -

        The onevent callback function is called for three types of events:
        begin
        complete
        success
        (See Spec Section 14.4.1).
        So the callback function will get called:

        • just before the request is sent (begin)
        • when the request is complete (complete)
        • after the response is sent (wthout error) (success)

        So an example use case for this callback would be to perform some logic based on
        the status in the data payload:

        Example:

        var statusUpdate = function statusUpdate(data) {
        if (data.status === "begin")

        { .... }

        else if (data.status === "success")

        { .... .... }

        I think Section 14.4.1 could be clarified a bit - and I also noticed that
        Table 14-4 does not mention the "status" property for the Event Data Payload.

        Show
        rogerk added a comment - The onevent callback function is called for three types of events: begin complete success (See Spec Section 14.4.1). So the callback function will get called: just before the request is sent (begin) when the request is complete (complete) after the response is sent (wthout error) (success) So an example use case for this callback would be to perform some logic based on the status in the data payload: Example: var statusUpdate = function statusUpdate(data) { if (data.status === "begin") { .... } else if (data.status === "success") { .... .... } I think Section 14.4.1 could be clarified a bit - and I also noticed that Table 14-4 does not mention the "status" property for the Event Data Payload.
        Hide
        rogerk added a comment -

        I'm marking this issue "INVALID" based on the assumption that the bug was
        because the callback function was caused multiple times.

        Show
        rogerk added a comment - I'm marking this issue "INVALID" based on the assumption that the bug was because the callback function was caused multiple times.
        Hide
        mwessendorf added a comment -

        somehow I forgot that;

        Q: do we have (or plan to have) global constants for "success" or "begin" ?

        Show
        mwessendorf added a comment - somehow I forgot that; Q: do we have (or plan to have) global constants for "success" or "begin" ?
        Hide
        Manfred Riem added a comment -

        Closing resolved issue out

        Show
        Manfred Riem added a comment - Closing resolved issue out

          People

          • Assignee:
            rogerk
            Reporter:
            mwessendorf
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: