- Add
autocomplete="off"
onto<form>
element; - Add hidden
<input>
withautocomplete="false"
as a first children element of the form.
<form autocomplete="off" method="post" action="">
<input autocomplete="false" name="hidden" type="text" style="display:none;">
...
This formation is going to prevent Chrome and Firefox to offer autofill and autocomplete for all input fields inside the form.
I found a very simple solution to the problem. I set the readonly attribute on the input fields, which prevents automatic filling. Then I remove the readonly attribute on the onfocus event, when the user clicks on the input field, it becomes writable.
<input name="email" onfocus="this.removeAttribute('readonly')" readonly type="text">