ICEfaces
  1. ICEfaces
  2. ICE-7569

Nested f:ajax tag in h:inputText causing issue with MenuItem ajax submit

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 3.0.RC1
    • Fix Version/s: 3.0.RC2, 3.0
    • Component/s: ACE-Components
    • Labels:
      None
    • Environment:
      ICEfaces 3.0 RC1, All browsers
    • Assignee Priority:
      P1
    • Workaround Exists:
      Yes
    • Workaround Description:
      Remove the f:ajax tag.

      Description

      In the WIlliams app they have a dataTable where one column contains an inputText field. Editing this field and then submitting the row vie a Menu Item is causing a JavaScript error to be thrown and the app becomes unresponsive. This h:inputText component is using a nested f:ajax tag. Removing this tag resolves the issue.

      This issue is reproducible on the Williams POC. To reproduce, load a tab with the Screen 1 content and click the retrieve button to load the table. The Name column contains an inputText field that has a nested f:ajax tag. Editing one of the input fields and then clicking on the Print menu item (top right hand side of page) will cause the JavaScript error to be thrown.

        Activity

        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26836 Mon Dec 12 14:33:27 MST 2011 mircea.toma ICE-7569 Test if source element exists before trying to search its corresponding viewID.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
        Arran Mccullough created issue -
        Arran Mccullough made changes -
        Field Original Value New Value
        Salesforce Case [5007000000JOm4n]
        Hide
        Ken Fyten added a comment -

        It's not clear what the behaviour in this case should be, other than obviously not blowing up with JS errors. I'd guess that the next f:ajax tag should be ignored since the submit is not being triggered within the h:inputText component?

        Show
        Ken Fyten added a comment - It's not clear what the behaviour in this case should be, other than obviously not blowing up with JS errors. I'd guess that the next f:ajax tag should be ignored since the submit is not being triggered within the h:inputText component?
        Ken Fyten made changes -
        Fix Version/s 3.0 [ 10241 ]
        Assignee Priority P2
        Assignee Mircea Toma [ mircea.toma ]
        Hide
        Ken Fyten added a comment -

        I just tested the fix with their app. It does look to have resolved the JS
        error. I am seeing one side effect, when the submit occurs they have some
        code to show a processing popup, following the same steps I don't see this
        popup displaying but the table row is updated. This is called through the
        onclick event of the menu item. Looking at the logs the call is made, but
        the popup doesn't get displayed.

        Arran

        Show
        Ken Fyten added a comment - I just tested the fix with their app. It does look to have resolved the JS error. I am seeing one side effect, when the submit occurs they have some code to show a processing popup, following the same steps I don't see this popup displaying but the table row is updated. This is called through the onclick event of the menu item. Looking at the logs the call is made, but the popup doesn't get displayed. Arran
        Ken Fyten made changes -
        Assignee Priority P2 P1
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26849 Tue Dec 13 09:50:49 MST 2011 mircea.toma ICE-7569 Assume user initiated submit when source element cannot be found.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/core/src/main/javascript/application.js
        Hide
        Mircea Toma added a comment -

        When deciding to invoke onBeforeUpdate listeners assume a user initiated submit when the form source element is undefined.

        Show
        Mircea Toma added a comment - When deciding to invoke onBeforeUpdate listeners assume a user initiated submit when the form source element is undefined.
        Hide
        Mircea Toma added a comment -

        A popup message is shown only when the triggered event handler invokes showProcessingMessage(msg) function. The 'onclick' event handler of the 'Print' tab does not call showProcessingMessage(), hence no popup shown.

        Show
        Mircea Toma added a comment - A popup message is shown only when the triggered event handler invokes showProcessingMessage(msg) function. The 'onclick' event handler of the 'Print' tab does not call showProcessingMessage(), hence no popup shown.
        Hide
        Arran Mccullough added a comment -

        Just tested on the Williams application the latest trunk code. It looks like its broken again. The following JS error is thrown when trying to submit the row:

        element is null
        return toLowerCase(element...' ? element : enclosingForm(element);

        Clicking on the error it is related to the follwing bridge.js (line 65) code:

        function formOf(element)

        { return toLowerCase(element.nodeName) == 'form' ? element : enclosingForm(element); }

        Show
        Arran Mccullough added a comment - Just tested on the Williams application the latest trunk code. It looks like its broken again. The following JS error is thrown when trying to submit the row: element is null return toLowerCase(element...' ? element : enclosingForm(element); Clicking on the error it is related to the follwing bridge.js (line 65) code: function formOf(element) { return toLowerCase(element.nodeName) == 'form' ? element : enclosingForm(element); }
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26864 Tue Dec 13 18:28:36 MST 2011 art.zambrano ICE-7569 potential fix
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/datatable/DataTable.java
        Hide
        Ken Fyten added a comment -

        Further testing shows that if the nested f:ajax tag does not actually render, things continue to work (<f:ajax execute="@this" render="@none "/> ).

        Show
        Ken Fyten added a comment - Further testing shows that if the nested f:ajax tag does not actually render, things continue to work (<f:ajax execute="@this" render="@none "/> ).
        Hide
        Ted Goddard added a comment -

        The onclick handler of the "print" button is as follows:

        onclick="this.id = 'sub_Screen1:screen1Form:printTab'; (function() { ice.ace.ab(

        {"source":"sub_Screen1:screen1Form:printTab","execute":((arguments[1]) ? arguments[1] + ' ' + '@all' : '@all'),"render":((arguments[2]) ? arguments[2] + ' ' + '@all' : '@all'),"event":"activate","params":arguments[0]}

        );; })(

        {'ice.customUpdate':'sub_Screen1:screen1Form:printTab'}

        );"

        The element ID should not be modified after the element is created, and especially not during event processing.

        Show
        Ted Goddard added a comment - The onclick handler of the "print" button is as follows: onclick="this.id = 'sub_Screen1:screen1Form:printTab'; (function() { ice.ace.ab( {"source":"sub_Screen1:screen1Form:printTab","execute":((arguments[1]) ? arguments[1] + ' ' + '@all' : '@all'),"render":((arguments[2]) ? arguments[2] + ' ' + '@all' : '@all'),"event":"activate","params":arguments[0]} );; })( {'ice.customUpdate':'sub_Screen1:screen1Form:printTab'} );" The element ID should not be modified after the element is created, and especially not during event processing.
        Hide
        Ted Goddard added a comment -

        The menu component must be modified to not use the illegal JavaScript technique. The modification of the id during event handling results in null "source" values during event processing.

        It might be possible to add error checking code to abort processing when the event source is null, but this would have unpredictable side effects.

        Show
        Ted Goddard added a comment - The menu component must be modified to not use the illegal JavaScript technique. The modification of the id during event handling results in null "source" values during event processing. It might be possible to add error checking code to abort processing when the event source is null, but this would have unpredictable side effects.
        Ted Goddard made changes -
        Assignee Mircea Toma [ mircea.toma ] Ken Fyten [ ken.fyten ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26880 Wed Dec 14 15:46:29 MST 2011 art.zambrano ICE-7569 changed client id handling in menu items for ajax requests
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/resources/icefaces.ace/core/core.js
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/ajax/AjaxBehaviorRenderer.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/menu/BaseMenuRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26887 Wed Dec 14 20:22:44 MST 2011 art.zambrano ICE-7569 added a timeout for triggering the menu item ajax request
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/menu/BaseMenuRenderer.java
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26890 Thu Dec 15 10:00:59 MST 2011 art.zambrano ICE-7569 check to see if node was provided in AjaxRequest before using it
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/resources/icefaces.ace/core/core.js
        Hide
        Ted Goddard added a comment -

        It may be possible to use a hidden field specific to this component and not use the element with the changing ID at all (for instance, make the "source" be the root of the menu). This is similar to how h:commandLink is implemented.

        Show
        Ted Goddard added a comment - It may be possible to use a hidden field specific to this component and not use the element with the changing ID at all (for instance, make the "source" be the root of the menu). This is similar to how h:commandLink is implemented.
        Ken Fyten made changes -
        Assignee Ken Fyten [ ken.fyten ] Arturo Zambrano [ artzambrano ]
        Hide
        Arturo Zambrano added a comment -

        This issue was fixed by avoiding setting the id to the element and then calling ice.ace.AjaxRequest. Instead, a node reference is provided to ice.ace.AjaxRequest and the id of the element will be set there, inside the function. The passed node reference will be used in the underlying submit functions. One more measure was taken to avoid conflicts with other ajax requests on the page. It consists of triggering the menu action with a delay via the setTimeout() function.

        Show
        Arturo Zambrano added a comment - This issue was fixed by avoiding setting the id to the element and then calling ice.ace.AjaxRequest. Instead, a node reference is provided to ice.ace.AjaxRequest and the id of the element will be set there, inside the function. The passed node reference will be used in the underlying submit functions. One more measure was taken to avoid conflicts with other ajax requests on the page. It consists of triggering the menu action with a delay via the setTimeout() function.
        Arturo Zambrano made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #26934 Fri Dec 16 16:02:03 MST 2011 art.zambrano ICE-7569 adjusted timeout to 10 milliseconds
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/ace/component/src/org/icefaces/ace/component/menu/BaseMenuRenderer.java
        Ken Fyten made changes -
        Fix Version/s 3.0.RC2 [ 10313 ]
        Ken Fyten made changes -
        Security Private [ 10001 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]

          People

          • Assignee:
            Arturo Zambrano
            Reporter:
            Arran Mccullough
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: