0

I've created a web FROM but Chrome autocomplete is populating the info in the wrong places. Chrome (Version 41.0.2272.89 (64-bit))

Despite both the input field AND the form field having the autocomplete="off" attribute, Chrome insists on showing a drop down history of previous entries for the field.

Sample From

<form accept-charset="UTF-8" action="/something" autocomplete="off" id="something_form" method="post">
<div style="margin:0;padding:0;display:inline">
  <input name="utf8" type="hidden" value="&#x2713;" />
  <input name="authenticity_token" type="hidden" value="xxxxxxxxxxxx" />
</div>
<div class="form-group no-padding col-xs-12 col-sm-12 col-md-12 col-lg-12">        
  <label class="control-label col-xs-4 col-md-4 col-sm-4 col-lg-4 no-padding text-right" for="from-course-name">
    Name:
  </label>
  <div class="controls col-xs-8 col-md-8 col-sm-8 col-lg-8 no-padding">
    <div class="input-append">
      <input id="from-name" inlineeditable-column="0" type="text" name="o_name" class="form-control custom-form_control required sensitive long "  autocomplete="off"  >
          </div>
        </div>
      </div>
</form>
MZaragoza
  • 9,447
  • 9
  • 60
  • 96

3 Answers3

0

On the input fields that you want to stop from auto complete this will work. Make the fields read only and on focus remove that attribute like this

<input readonly onfocus="this.removeAttribute('readonly');" onblur="this.setAttribute('readonly');"  id="from-name" type="text" name="o_name" class="form-control custom-form_control required ">
MZaragoza
  • 9,447
  • 9
  • 60
  • 96
0

In Chrome autocomplete="off" only works for fields other then password, email, username, mobile, zipcode, city, ...

If the field's name or id is like id="blabla-password" or name"email-blabla" or id="bla-username-bla" etc... then you have to use the following

id="bla-bla-some-password" autocomplete="new-password"
id="bla-email-bla"         autocomplete="new-email"
id="some-username-id"      autocomplete="new-username" 
name="bla-password"        autocomplete="new-password"
name="bla-email-bla"       autocomplete="new-email"
name="some-username-id"    autocomplete="new-username"
...city                    autocomplete="nope"
...zipcode                 autocomplete="nope"
...mobile                  autocomplete="nope"
...

For all the other fields keep using autocomplete="off" ! It is still the best result

id="description" autocomplete="off"
id="date"        autocomplete="off"
id="some-text"   autocomplete="off"
...

And so on

Julesezaar
  • 1,425
  • 1
  • 11
  • 16
0

Chrome has been ignoring autocomplete="off" for a while now, you have to trick chrome by doing the following: 1. Set the input type to text, and 2. reset the input type when on focus event is triggered

<input type="text" id="password" autocomplete="off" name="password">


$('#password').on('focus', function(){
    $('#password').attr('type', 'password');
});

Reset done using Jquery