ICEfaces
  1. ICEfaces
  2. ICE-5574

Make behavior uniform across all browser for "submit on enter" with input components

    Details

    • Type: New Feature New Feature
    • Status: Closed
    • Priority: Major Major
    • Resolution: Fixed
    • Affects Version/s: 2.0-Alpha2
    • Fix Version/s: 2.0-Alpha3, 2.0.0
    • Component/s: Bridge
    • Labels:
      None
    • Environment:
      ICEfaces 2.0 Alpha2 / JSF 2.

      Description

      In ICEfaces 1.x the doSubmit() function in the bridge would block the default submit on enter functionality that is present in some browsers when Enter is pressed inside an HTML input element. We need a similar mechanism for ICEfaces 2.0, to allow the components themselves full control over submit processing as triggered by the enter key.

        Issue Links

          Activity

          Hide
          Mircea Toma added a comment -

          Introduced system event listener that wires up any rendered form to capture enter key presses. The JS event handler is registered with the form element capturing thus any enter key presses that can arrive from any input or select elements enclosed within the form.

          Here's a link that describes the difference in IE's behavior without the fix for this issue: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter .

          Show
          Mircea Toma added a comment - Introduced system event listener that wires up any rendered form to capture enter key presses. The JS event handler is registered with the form element capturing thus any enter key presses that can arrive from any input or select elements enclosed within the form. Here's a link that describes the difference in IE's behavior without the fix for this issue: http://www.thefutureoftheweb.com/blog/submit-a-form-in-ie-with-enter .
          Hide
          Ken Fyten added a comment -

          We'll need a test page for this that puts all the std h: components in a single form. The test will then to set the focus on each h: component in turn and press the enter key, and then record if the form is submitted (or not) as a result of the enter key being pressed.

          Show
          Ken Fyten added a comment - We'll need a test page for this that puts all the std h: components in a single form. The test will then to set the focus on each h: component in turn and press the enter key, and then record if the form is submitted (or not) as a result of the enter key being pressed.
          Hide
          Joanne Bai added a comment -

          Test has been added to repo\qa\trunk\Regression-Icefaces2\ICE-5574, and has been tested successfully using FF3.6, IE8, and Chrome 4 against Tomcat6.0.26

          Glimmer revision: 21233

          Test includes the following h: components:

          commandButton
          commandLink
          inputSecret
          inputText
          inputTextarea
          selectBooleanCheckbox
          selectManyCheckbox
          selectManyListbox
          selectManyMenu
          selectOneListbox
          selectOneMenu
          selectOneRadio

          Show
          Joanne Bai added a comment - Test has been added to repo\qa\trunk\Regression-Icefaces2\ ICE-5574 , and has been tested successfully using FF3.6, IE8, and Chrome 4 against Tomcat6.0.26 Glimmer revision: 21233 Test includes the following h: components: commandButton commandLink inputSecret inputText inputTextarea selectBooleanCheckbox selectManyCheckbox selectManyListbox selectManyMenu selectOneListbox selectOneMenu selectOneRadio
          Hide
          Ken Fyten added a comment -

          Joanne,

          Please run your test with the following changes and then produce a report listing which components performed a submit when enter was pressed and which did not.

          Please use IE6 and FF3.6 for these tests.

          • Without icefaces in the configuration (stock JSF2 only).
          • With icefaces in the configuration.
          • Using ice: (compat) compnents instead of h: components.
          Show
          Ken Fyten added a comment - Joanne, Please run your test with the following changes and then produce a report listing which components performed a submit when enter was pressed and which did not. Please use IE6 and FF3.6 for these tests. Without icefaces in the configuration (stock JSF2 only). With icefaces in the configuration. Using ice: (compat) compnents instead of h: components.
          Hide
          Joanne Bai added a comment -

          Glimmer revision: 21283
          Browsers: FF3.6, IE6

          1. Without icefaces in the configuration (stock JSF2 only)

          • submits properly when Enter is pressed
            commandButton
            commandLink
          • submit does not work properly - pressing Enter triggers the submit for command button/link
            inputSecret
            inputText
            selectOneRadio
            selectManyCheckbox
            selectBooleanCheckbox
          • nothing happens when pressing Enter
            selectOneMenu
            selectOneListbox
            selectManyMenu
            selectManyListbox

          inputTextarea - pressing Enter changes lines in the input text area

          Show
          Joanne Bai added a comment - Glimmer revision: 21283 Browsers: FF3.6, IE6 1. Without icefaces in the configuration (stock JSF2 only) submits properly when Enter is pressed commandButton commandLink submit does not work properly - pressing Enter triggers the submit for command button/link inputSecret inputText selectOneRadio selectManyCheckbox selectBooleanCheckbox nothing happens when pressing Enter selectOneMenu selectOneListbox selectManyMenu selectManyListbox inputTextarea - pressing Enter changes lines in the input text area
          Hide
          Joanne Bai added a comment -

          2. With icefaces in the configuration

          • submits properly when Enter is pressed
            inputSecret
            inputText
            inputTextarea
            selectBooleanCheckbox
            selectManyCheckbox
            selectManyListbox
            selectManyMenu
            selectOneListbox
            selectOneMenu
            selectOneRadio
          • for command button and command link, the first click or the first press of Enter does not submit. The second click or Enter press does. There's warning showing in the server console:
            WARNING: Old DOM is null during domDiff calculation for javax.faces.ViewState
          Show
          Joanne Bai added a comment - 2. With icefaces in the configuration submits properly when Enter is pressed inputSecret inputText inputTextarea selectBooleanCheckbox selectManyCheckbox selectManyListbox selectManyMenu selectOneListbox selectOneMenu selectOneRadio for command button and command link, the first click or the first press of Enter does not submit. The second click or Enter press does. There's warning showing in the server console: WARNING: Old DOM is null during domDiff calculation for javax.faces.ViewState
          Hide
          Joanne Bai added a comment -

          3. Using ice: (compat) compnents instead of h: components.

          1) NullPointerException is thrown for SelectManyCheckbox
          com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException
          SEVERE: Error Rendering View[/main.xhtml]
          java.lang.NullPointerException
          at com.icesoft.faces.renderkit.dom_html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:137)
          at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620)
          at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616)

          2) if remove SelectManyCheckbox component and test again:

          • submits properly when Enter is pressed
            inputSecret
            inputText
            inputTextarea
            commandButton
          • submits properly once selected (Enter key is not really involved)
            selectBooleanCheckbox
            selectManyListbox
            selectManyMenu
            selectOneListbox
            selectOneMenu
            selectOneRadio
          • submits not happening with Enter
            commandLink (click will submit)
          Show
          Joanne Bai added a comment - 3. Using ice: (compat) compnents instead of h: components. 1) NullPointerException is thrown for SelectManyCheckbox com.sun.faces.application.view.FaceletViewHandlingStrategy handleRenderException SEVERE: Error Rendering View [/main.xhtml] java.lang.NullPointerException at com.icesoft.faces.renderkit.dom_html_basic.SelectManyCheckboxListRenderer.encodeEnd(SelectManyCheckboxListRenderer.java:137) at javax.faces.component.UIComponentBase.encodeEnd(UIComponentBase.java:878) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1620) at javax.faces.component.UIComponent.encodeAll(UIComponent.java:1616) 2) if remove SelectManyCheckbox component and test again: submits properly when Enter is pressed inputSecret inputText inputTextarea commandButton submits properly once selected (Enter key is not really involved) selectBooleanCheckbox selectManyListbox selectManyMenu selectOneListbox selectOneMenu selectOneRadio submits not happening with Enter commandLink (click will submit)
          Hide
          Ken Fyten added a comment -

          Need to investigate the issues reported with icefaces and the h:commandButton and commandLink, and then move onto the more serious ice: compat problems.

          Show
          Ken Fyten added a comment - Need to investigate the issues reported with icefaces and the h:commandButton and commandLink, and then move onto the more serious ice: compat problems.
          Hide
          Mircea Toma added a comment - - edited

          All h:* components work properly, including h:commandButton and h:commandLink. "repo\qa\trunk\Regression-Icefaces2\ICE-5574" test is using forward navigation for h:commandButton and h:commandLink when successfully submitted. But there seems to be a bug with navigation in JSF 2.0.2 because the javax.faces.ViewState hidden input fields belonging to the forms are missing after navigation is executed (hence oldDOM = null).
          Modifying the test to have h:commandLink and h:commandButton increment an associated counter instead of running navigation rules shows that these components work as well.

          Show
          Mircea Toma added a comment - - edited All h:* components work properly, including h:commandButton and h:commandLink. "repo\qa\trunk\Regression-Icefaces2\ ICE-5574 " test is using forward navigation for h:commandButton and h:commandLink when successfully submitted. But there seems to be a bug with navigation in JSF 2.0.2 because the javax.faces.ViewState hidden input fields belonging to the forms are missing after navigation is executed (hence oldDOM = null). Modifying the test to have h:commandLink and h:commandButton increment an associated counter instead of running navigation rules shows that these components work as well.
          Hide
          Mircea Toma added a comment -

          As for ice:* components here are my discoveries:

          1) ice:selectManyCheckbox – indeed the NullPointerException is present, looking at the renderer code it is obvious that when a SelectItemGroup is nested the markup generation is wrong. I'll attach a patch to this case for com.icesoft.faces.renderkit.dom_html_basic.SelectManyCheckboxListRenderer.

          2) Following components work as expected as long "partialSubmit" attribute is removed:
          selectBooleanCheckbox
          selectManyListbox
          selectManyMenu
          selectOneListbox
          selectOneMenu
          selectOneRadio

          3) ice:commandLink is not working because the rendered anchor normally changes the value of a hidden input element (in the event handler) just before invoking iceSubmit. When Enter key is pressed iceSubmit will serialize the hidden input field, but its value is not changed as required.
          I guess the solution would be to change renderer's decode method to not rely on the named input hidden field.

          Show
          Mircea Toma added a comment - As for ice:* components here are my discoveries: 1) ice:selectManyCheckbox – indeed the NullPointerException is present, looking at the renderer code it is obvious that when a SelectItemGroup is nested the markup generation is wrong. I'll attach a patch to this case for com.icesoft.faces.renderkit.dom_html_basic.SelectManyCheckboxListRenderer. 2) Following components work as expected as long "partialSubmit" attribute is removed: selectBooleanCheckbox selectManyListbox selectManyMenu selectOneListbox selectOneMenu selectOneRadio 3) ice:commandLink is not working because the rendered anchor normally changes the value of a hidden input element (in the event handler) just before invoking iceSubmit. When Enter key is pressed iceSubmit will serialize the hidden input field, but its value is not changed as required. I guess the solution would be to change renderer's decode method to not rely on the named input hidden field.
          Hide
          Mircea Toma added a comment -

          Changed submit code to avoid form submission when Enter key is pressed in textarea elements. The affected components, h:inputTextarea and ice:inputTextarea, are not going to submit the form on Enter.

          Show
          Mircea Toma added a comment - Changed submit code to avoid form submission when Enter key is pressed in textarea elements. The affected components, h:inputTextarea and ice:inputTextarea, are not going to submit the form on Enter.
          Hide
          Ken Fyten added a comment -

          Follow-up JIRAs created for issue #1, ice:selectManyCheckbox (ICE-5672), and issue #3, ice:commandLink (ICE-5673) above.

          Marking fixed.

          Show
          Ken Fyten added a comment - Follow-up JIRAs created for issue #1, ice:selectManyCheckbox (ICE-5672), and issue #3, ice:commandLink (ICE-5673) above. Marking fixed.
          Hide
          Ken Fyten added a comment -

          Another follow-up issue from this JIRA: ICE-6014.

          Show
          Ken Fyten added a comment - Another follow-up issue from this JIRA: ICE-6014 .

            People

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

              Dates

              • Created:
                Updated:
                Resolved: