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

          People

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

            Dates

            • Created:
              Updated:
              Resolved: