4

A have form with lots of inputs. Each one of them gets validated and saved on focus out.

The trouble is that when user autofills several inputs by Chrome, there is no focusout events on that field, so they are not saved.

Is it possible to catch event when Chrome fills inputs - to validate them at that moment?

Prosto Trader
  • 3,471
  • 3
  • 31
  • 52
  • 1
    I think this has been answered [here](http://stackoverflow.com/questions/11708092/detecting-browser-autofill), in short, you can't. As schnellboot writes, I think the best thing to do is just to disable it.. – Martin M Mar 13 '15 at 13:58

1 Answers1

2

I had the same problem a while ago and in my case I just disabled autocomplete.

If your code needs to know when the value of a field changes, you have two choices:

  1. Have some JavaScript code that runs at a regular interval, checks the value of all the fields, and calls your change handler when it notices that a value has changed.
  2. Disable autocomplete by adding autocomplete="off" on the element. This technique has been supported by browsers since IE 5 (March 1999) and Netscape 6.2 (October 2001), and now made its way into HTML5.

source