ICEfaces
  1. ICEfaces
  2. ICE-6014

ICEfaces 2.0 "submit on enter" feature causing double-submits on h:inputText w/ action listener

    Details

    • Type: Bug Bug
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Beta1
    • Fix Version/s: 2.0-Beta2, 2.0.0
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      ICEfaces 2.0, JSF std h: components (Mojarra JSF 2.0.3)

      Description

      Problem: enter key on h:inputText w/ actionListener causes 2 submits, full form submit (via enter key pressed on h:inputText, from the bridge?), followed by action event submit form the h:inputText.

      The issue is that we have assumed that any component that fired an action event on "enter" would also consume the "enter" key event so that it would not bubble up the DOM. This appears to be an incorrect assumption in this case.

      - this behavior can cause problems with validators/users as the they are
      under the perception that just one submit has occurred, the double submit
      will likely leave the application in an unexpected state.

      - Workaround in auction is to avoid having an action listener on the input field.

      - Ideally the framework would not do the full form submit if the component already had an action listener ready to fire.

        Issue Links

          Activity

          Ken Fyten created issue -
          Ken Fyten made changes -
          Field Original Value New Value
          Salesforce Case []
          Fix Version/s 2.0-Beta2 [ 10242 ]
          Assignee Priority P2
          Assignee Mircea Toma [ mircea.toma ]
          Mircea Toma made changes -
          Link This issue duplicates ICE-5536 [ ICE-5536 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #22286 Wed Sep 08 07:11:27 MDT 2010 mircea.toma ICE-5536, ICE-6014 Cancel default action and event bubbling to avoid double submit.
          Files Changed
          Commit graph MODIFY /icefaces2/trunk/icefaces/core/src/main/javascript/submit.js
          Hide
          Mircea Toma added a comment -

          Modified ice.s and ice.ss functions to cancel the event bubbling. In case there is an event handler on the event triggering form element the event will not propagate to the parent 'form' element thus avoiding the additional submit.

          Show
          Mircea Toma added a comment - Modified ice.s and ice.ss functions to cancel the event bubbling. In case there is an event handler on the event triggering form element the event will not propagate to the parent 'form' element thus avoiding the additional submit.
          Mircea Toma made changes -
          Status Open [ 1 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Hide
          Patrick Corless added a comment -

          Just checked in some changes for the the compat/auctionMonitor to use standard JSF validation, more or less, http://jira.icefaces.org/browse/ICE-5975.

          The auction monitor's bid inputText field now has an action listener that will handle a bid as well as a validator to check the bid. When I types a new bid value and type renturn I get a double submit. The first bid/submit is accepted and the effect fires but the second submit resends the bid value resulting in a validation error as the bid is equal to the current item price.

          I've done a full clean and build of the core and compat so I don't think I'm seeing a JavaScript cache issue. Can you start up compat/auctionMonitor to see if you can reproduce the behaviour I'm seeing?

          Show
          Patrick Corless added a comment - Just checked in some changes for the the compat/auctionMonitor to use standard JSF validation, more or less, http://jira.icefaces.org/browse/ICE-5975 . The auction monitor's bid inputText field now has an action listener that will handle a bid as well as a validator to check the bid. When I types a new bid value and type renturn I get a double submit. The first bid/submit is accepted and the effect fires but the second submit resends the bid value resulting in a validation error as the bid is equal to the current item price. I've done a full clean and build of the core and compat so I don't think I'm seeing a JavaScript cache issue. Can you start up compat/auctionMonitor to see if you can reproduce the behaviour I'm seeing?
          Patrick Corless made changes -
          Resolution Fixed [ 1 ]
          Status Resolved [ 5 ] Reopened [ 4 ]
          Repository Revision Date User Message
          ICEsoft Public SVN Repository #22399 Thu Sep 23 06:47:52 MDT 2010 mircea.toma ICE-6014 Change order of inheritance for the events that use multiple inheritance to make sure the isKeyEvent or isMouseEvent methods are overrriden as expected.
          Files Changed
          Commit graph MODIFY /projects/bridge-support/src/main/javascript/event.js
          Hide
          Mircea Toma added a comment -

          The test in ice.submit function which verifies if an event needs to have its default action canceled fails to return true when the enter key is pressed. More precisely isKeyEvent returns 'false' which is not correct since the event is triggered by a key press. The browser specific key events inherit from both KeyEvent and NetscapeEvent/IEEvent classes. isKeyEvent is not overridden because the object will pick the method of the first defined ancestor (NetscapeEvent/IEEvent ), but really the method expected to be picked is found on the KeyEvent ancestor.

          To fix changes the order of inheritance for the events that use multiple inehritance to make sure the isKeyEvent or isMouseEvent are overrriden properly.

          Show
          Mircea Toma added a comment - The test in ice.submit function which verifies if an event needs to have its default action canceled fails to return true when the enter key is pressed. More precisely isKeyEvent returns 'false' which is not correct since the event is triggered by a key press. The browser specific key events inherit from both KeyEvent and NetscapeEvent/IEEvent classes. isKeyEvent is not overridden because the object will pick the method of the first defined ancestor (NetscapeEvent/IEEvent ), but really the method expected to be picked is found on the KeyEvent ancestor. To fix changes the order of inheritance for the events that use multiple inehritance to make sure the isKeyEvent or isMouseEvent are overrriden properly.
          Mircea Toma made changes -
          Status Reopened [ 4 ] Resolved [ 5 ]
          Resolution Fixed [ 1 ]
          Ken Fyten made changes -
          Fix Version/s 2.0.0 [ 10230 ]
          Ken Fyten made changes -
          Status Resolved [ 5 ] Closed [ 6 ]
          Assignee Priority P2

            People

            • Assignee:
              Mircea Toma
              Reporter:
              Ken Fyten
            • Votes:
              0 Vote for this issue
              Watchers:
              0 Start watching this issue

              Dates

              • Created:
                Updated:
                Resolved: