Uploaded image for project: 'RichFaces'
  1. RichFaces
  2. RF-3986

oncomplete documentation in richfaces_userguide.pdf wrong

    Details

    • Type: Task
    • Status: Closed (View Workflow)
    • Priority: Major
    • Resolution: Done
    • Affects Version/s: 3.1.5
    • Fix Version/s: 3.3.0
    • Component/s: doc
    • Labels:
      None

      Description

      I assume there is a bug in the current richfaces-userguide.pdf, section 5.4.5. JavaScript Interactions:
      It says:
      "oncomplete" attribute allows to invoke the JavaScript code right after the Ajax Response is returned back and the DOM tree of the browser is updated. Richfaces registers the code for further invocation of XMLHTTP request object before an Ajax request is sent. This means the code will not be changed during processing of the request on the server if you use JSF EL value binding. Also, you cannot use "this'" inside the code, because it will not point the component where Ajax request was initiated.

      Is this description deprecated or is the implementation in richfaces 3.1.5 wrong?

      sample:
      actionListener="#

      {mybean.al}

      "
      oncomplete="#

      {!empty requestScope['someVar']?'doA();':'doB();'}

      "
      depending on what I do in my actionListener doA or doB is called.

      Therefore I think the documentation has to be updated.

        Gliffy Diagrams

          Activity

          Hide
          atsebro Alex Tserbo added a comment -

          Hi. I need more input info on this issue to find out what the problem is. What the component you use this attribute with? What exactly you wish to do? Please, send me your code snippet.

          The example of code below contains the "oncomplete" attribute that is used to show modal panel after defined event:

          ...
          <a4j:support event="onexpand"
          actionListener="#

          {bean.stateTrue}

          "
          reRender="repeater"
          oncomplete="Richfaces.showModalPanel('myForm:panel')" />
          ...

          Show
          atsebro Alex Tserbo added a comment - Hi. I need more input info on this issue to find out what the problem is. What the component you use this attribute with? What exactly you wish to do? Please, send me your code snippet. The example of code below contains the "oncomplete" attribute that is used to show modal panel after defined event: ... <a4j:support event="onexpand" actionListener="# {bean.stateTrue} " reRender="repeater" oncomplete="Richfaces.showModalPanel('myForm:panel')" /> ...
          Hide
          atsebro Alex Tserbo added a comment -

          One more request for input info is sent to the reporter's email.

          Show
          atsebro Alex Tserbo added a comment - One more request for input info is sent to the reporter's email.
          Hide
          mhn Michael Heinen added a comment -

          Sorry for delayed answer, I was on vacation.

          Documentation says that
          "Richfaces registers the code for further invocation of XMLHTTP request object before an Ajax request is sent. This means the code will not be changed during processing of the request on the server if you use JSF EL value binding".
          This sound to me that EL expressions are evaluated before the request is sent which is not true.

          If I use s.th. like this in an oncomplete attribute
          oncomplete="#

          {!empty requestScope['someVar']?'doA();':'doB();'}

          "
          and set/remove someVar in the called actionListener then either doA or doB is called.

          According to documentation the EL expression would be evaluated before ajax request is sent, or ?

          Show
          mhn Michael Heinen added a comment - Sorry for delayed answer, I was on vacation. Documentation says that "Richfaces registers the code for further invocation of XMLHTTP request object before an Ajax request is sent. This means the code will not be changed during processing of the request on the server if you use JSF EL value binding". This sound to me that EL expressions are evaluated before the request is sent which is not true. If I use s.th. like this in an oncomplete attribute oncomplete="# {!empty requestScope['someVar']?'doA();':'doB();'} " and set/remove someVar in the called actionListener then either doA or doB is called. According to documentation the EL expression would be evaluated before ajax request is sent, or ?
          Hide
          atsebro Alex Tserbo added a comment -

          No, the EL-expression passed with "oncomplete" would be evaluated after an AJAX response comes back. The description should be as following:

          "The "oncomplete" attribute is used for passing JavaScript that would be invoked right after the Ajax Response returns back and DOM is updated. It is not recommended to use use "this'" inside the EL-expression, because it will not always point to the component where Ajax request was initiated. "

          Show
          atsebro Alex Tserbo added a comment - No, the EL-expression passed with "oncomplete" would be evaluated after an AJAX response comes back. The description should be as following: "The "oncomplete" attribute is used for passing JavaScript that would be invoked right after the Ajax Response returns back and DOM is updated. It is not recommended to use use "this'" inside the EL-expression, because it will not always point to the component where Ajax request was initiated. "
          Hide
          atsebro Alex Tserbo added a comment -

          The description is updated (see documentation nightly builds for changes)

          Show
          atsebro Alex Tserbo added a comment - The description is updated (see documentation nightly builds for changes)
          Hide
          jbalunas Jay Balunas added a comment -

          Part of a bulk update, all resolutions changed to done, please review history to original resolution type

          Show
          jbalunas Jay Balunas added a comment - Part of a bulk update, all resolutions changed to done, please review history to original resolution type

            People

            • Assignee:
              nbelaevski Nick Belaevski
              Reporter:
              mhn Michael Heinen
            • Votes:
              0 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved:

                Development