ICEfaces
  1. ICEfaces
  2. ICE-7186

Browser auto-fill/complete interfering with input validation

    Details

    • Workaround Exists:
      Yes
    • Workaround Description:
      Hide
      <script type="text/javascript">
      function disableKeyPress(e)
      {
      var key;
      if(window.event)
      key = window.event.keyCode; //IE
      else
      key = e.which; //firefox

      return (key != 13);
      }
      </script>

      <ice:inputText id="name" value="#{bean.value}" required="true"
      onkeypress="return disableKeyPress(event);"/>
      Show
      <script type="text/javascript"> function disableKeyPress(e) { var key; if(window.event) key = window.event.keyCode; //IE else key = e.which; //firefox return (key != 13); } </script> <ice:inputText id="name" value="#{bean.value}" required="true" onkeypress="return disableKeyPress(event);"/>

      Description

      The web browsers auto-complete/auto-fill selection is interfering with input validation in an ice:inputText. The user will enter text, the browser will present a list of auto-complete options, they will then select an item using the keyboard and then press enter. The issue is that since the focus is still in the ice:inputText, the value is submitted. This is due to the ice:inputText using the enter key listener to fire the action event. The recommendation is to extend the ice:inputText component (new attribute) to prevent enter key submission for this scenario.

        Activity

        Tyler Johnson created issue -
        Tyler Johnson made changes -
        Field Original Value New Value
        Workaround Description <script type="text/javascript">
        function disableKeyPress(e)
        {
        var key;
        if(window.event)
        key = window.event.keyCode; //IE
        else
        key = e.which; //firefox

        return (key != 13);
        }
        </script>

        <ice:inputText id="name" value="#{bean.value}" required="true"
        onkeypress="return disableKeyPress(event);"/>
        Workaround Exists [Yes]
        Salesforce Case [5007000000I0ziK]
        Ken Fyten made changes -
        Fix Version/s EE-1.8.2.GA_P04 [ 10280 ]
        Hide
        Ken Fyten added a comment -

        We believe that the fix for this involves having the ice:inputText not register an Enter key listener at all if there is no action event listener defined. That way, pressing enter when the autocomplete popup is shown will not submit the form before the newly selected value (from the autocomplete popup) can be set in the component.

        Something to be aware of here is that the ice:form has support for automatically submitting the form if enter is pressed in an input component on the form. This feature may or may not be involved in the customers use-case. If this feature is enabled then it's impact on the overall outcome will need to be analyzed and a different solution may be required.

        Show
        Ken Fyten added a comment - We believe that the fix for this involves having the ice:inputText not register an Enter key listener at all if there is no action event listener defined. That way, pressing enter when the autocomplete popup is shown will not submit the form before the newly selected value (from the autocomplete popup) can be set in the component. Something to be aware of here is that the ice:form has support for automatically submitting the form if enter is pressed in an input component on the form. This feature may or may not be involved in the customers use-case. If this feature is enabled then it's impact on the overall outcome will need to be analyzed and a different solution may be required.
        Tyler Johnson made changes -
        Issue Type New Feature [ 2 ] Improvement [ 4 ]
        Ken Fyten made changes -
        Assignee Priority P2
        Assignee Mircea Toma [ mircea.toma ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #27740 Thu Feb 09 15:08:39 MST 2012 mircea.toma ICE-7186 Use 'keyUp' instead of 'keyPress' event on enter key to execute the form submit. This gives a chance to the browser to pick up the selected value from the native auto-complete popup before the submit.
        Files Changed
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/SecretRenderer.java
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/TextRenderer.java
        Commit graph MODIFY /icefaces/trunk/icefaces/component/src/com/icesoft/faces/component/ext/renderkit/InputTextRenderer.java
        Hide
        Mircea Toma added a comment -

        Use 'keyUp' instead of 'keyPress' event on enter key to execute the form submit. This gives a chance to the browser to pick up the selected value from the native auto-complete popup before the submit.

        Show
        Mircea Toma added a comment - Use 'keyUp' instead of 'keyPress' event on enter key to execute the form submit. This gives a chance to the browser to pick up the selected value from the native auto-complete popup before the submit.
        Mircea Toma made changes -
        Status Open [ 1 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Ken Fyten made changes -
        Resolution Fixed [ 1 ]
        Status Resolved [ 5 ] Reopened [ 4 ]
        Ken Fyten made changes -
        Fix Version/s 3.0.1 [ 10282 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #27795 Mon Feb 13 04:23:15 MST 2012 mircea.toma ICE-7186 Use 'keyUp' instead of 'keyPress' event on enter key to execute the form submit. This gives a chance to the browser to pick up the selected value from the native auto-complete popup before the submit.
        Files Changed
        Commit graph MODIFY /icefaces3/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/SecretRenderer.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/InputTextRenderer.java
        Commit graph MODIFY /icefaces3/trunk/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/TextRenderer.java
        Mircea Toma made changes -
        Status Reopened [ 4 ] Resolved [ 5 ]
        Resolution Fixed [ 1 ]
        Repository Revision Date User Message
        ICEsoft Public SVN Repository #27923 Fri Feb 17 11:16:58 MST 2012 ken.fyten ICE-7186 Use 'keyUp' instead of 'keyPress' event on enter key to execute the form submit. This gives a chance to the browser to pick up the selected value from the native auto-complete popup before the submit.
        Files Changed
        Commit graph MODIFY /icefaces3/branches/icefaces-3.0.x-maintenance/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/TextRenderer.java
        Commit graph MODIFY /icefaces3/branches/icefaces-3.0.x-maintenance/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/SecretRenderer.java
        Commit graph MODIFY /icefaces3/branches/icefaces-3.0.x-maintenance/icefaces/compat/components/src/main/java/com/icesoft/faces/component/ext/renderkit/InputTextRenderer.java
        Hide
        Ken Fyten added a comment -

        Added missing commit to the icefaces-3.0.x-maintenance branch. SVN rvn# 27923.

        Show
        Ken Fyten added a comment - Added missing commit to the icefaces-3.0.x-maintenance branch. SVN rvn# 27923.
        Ken Fyten made changes -
        Fix Version/s EE-3.0.0.BETA [ 10324 ]
        Ken Fyten made changes -
        Issue Type Improvement [ 4 ] Bug [ 1 ]
        Ken Fyten made changes -
        Status Resolved [ 5 ] Closed [ 6 ]
        Assignee Priority P2

          People

          • Assignee:
            Mircea Toma
            Reporter:
            Tyler Johnson
          • Votes:
            1 Vote for this issue
            Watchers:
            2 Start watching this issue

            Dates

            • Created:
              Updated:
              Resolved: