ICEfaces
  1. ICEfaces
  2. ICE-8927

JavascriptContext.addJavascriptCall() doesn't work after a forward navigation

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: EE-1.8.2.GA_P04, EE-1.8.2.GA_P05
    • Fix Version/s: EE-1.8.2.GA_P06
    • Component/s: Bridge, Framework
    • Labels:
      None
    • Environment:
      All
    • Assignee Priority:
      P1
    • Salesforce Case Reference:
    • Workaround Exists:
      Yes
    • Workaround Description:
      Use a redirect navigation instead of a forward

      Description

      After a forward navigation is done, if the page has commandButtons that execute a JavascriptContext.addJavascriptCall() view an action or actionListener method, the script added to this call is not executed.


        Activity

        Hide
        Arran Mccullough added a comment -

        Attached test case that shows the issue.

        Steps:

        • Load http://localhost:XXXX/Case11884Example/
        • Click on the 'Page Three' button.
        • Page3.jspx is now shown.
        • Clicking on the buttons should display an alert JavaScript. In the server logs there should be logs showing that these methods are being called.
        Show
        Arran Mccullough added a comment - Attached test case that shows the issue. Steps: Load http://localhost:XXXX/Case11884Example/ Click on the 'Page Three' button. Page3.jspx is now shown. Clicking on the buttons should display an alert JavaScript. In the server logs there should be logs showing that these methods are being called.
        Hide
        Arran Mccullough added a comment -

        I have a few observations. With the attached sample if you click on the 'Page Two' button, this will forward to Page2.jspx and also call a JavascriptContext.addJavascriptCall() which will show an alert. This is working as long as some navigation is done in the same action method.

        Show
        Arran Mccullough added a comment - I have a few observations. With the attached sample if you click on the 'Page Two' button, this will forward to Page2.jspx and also call a JavascriptContext.addJavascriptCall() which will show an alert. This is working as long as some navigation is done in the same action method.
        Hide
        Arran Mccullough added a comment -

        Note: This does not seem to be an issue in ICEfaces 3 using the same JavascriptContext API.

        Show
        Arran Mccullough added a comment - Note: This does not seem to be an issue in ICEfaces 3 using the same JavascriptContext API.
        Hide
        Mircea Toma added a comment -

        The issue occurs when a previous update (page navigation in this case) replaces the body element. The scripts are stripped from the updating markup to be evaluated afterwards. During the second update (when the "Test Action Listener" button is clicked) the script elements that needs to be replaced does not exists thus causing a JS error (seen in the log window).

        The fix modifies the regular expression used for finding script elements in the updated markup to use grouping for start tag, content and end tag. Then making use of this REGEXP grouping, the matched script tags are replaced with the same tags but without their content, thus making sure the script elements are present in the DOM.

        Show
        Mircea Toma added a comment - The issue occurs when a previous update (page navigation in this case) replaces the body element. The scripts are stripped from the updating markup to be evaluated afterwards. During the second update (when the "Test Action Listener" button is clicked) the script elements that needs to be replaced does not exists thus causing a JS error (seen in the log window). The fix modifies the regular expression used for finding script elements in the updated markup to use grouping for start tag, content and end tag. Then making use of this REGEXP grouping, the matched script tags are replaced with the same tags but without their content, thus making sure the script elements are present in the DOM.
        Hide
        Cruz Miraback added a comment -

        Confirmed fixed using ICEfaces 1.8.2.GA_P06 build 1 in Firefox19, Chrome24, IE6/7/9.

        Show
        Cruz Miraback added a comment - Confirmed fixed using ICEfaces 1.8.2.GA_P06 build 1 in Firefox19, Chrome24, IE6/7/9.

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: