5

I am dealing with a text area in part of a contact form that Chrome wants to autofill with the user's address. As a result many contact requests are submitted by users with their address in the comment field. Besides the obvious potential security issues that could be exploited, my concern is that from a user's standpoint we're providing a contact form without an area to type a message. And from a support standpoint, we're having to ask users to send us another message with their actual question.

HTML:

 <textarea id="element_10" class="validate[required] floatlabel js-auto-size multiple-lines" name="element_10" placeholder="Message*" rows="10" cols="60" required autocomplete="off"></textarea>
block14
  • 607
  • 1
  • 6
  • 24
  • 1
    Whoever finds this, here's an older SO question that seems to be continuously updated: [Disabling Chrome Autofill](https://stackoverflow.com/questions/15738259/disabling-chrome-autofill) – aexl May 08 '20 at 11:35

2 Answers2

12

Answering my own question since I did not find the answer on Stack or in any Chrome browser docs.

In some cases, the browser will keep suggesting autocompletion values even if the autocomplete attribute is set to off. This unexpected behavior can be quite puzzling for developers. The trick to really forcing the no-autocompletion is to assign a random string to the attribute, for example:

autocomplete="nope"

Since this random value is not a valid one, the browser will give up.

https://developer.mozilla.org/en-US/docs/Web/Security/Securing_your_site/Turning_off_form_autocompletion

block14
  • 607
  • 1
  • 6
  • 24
  • Actually may not help in all cases. More details in Chrome bug discussion: https://bugs.chromium.org/p/chromium/issues/detail?id=914451#c99 – Robo Burned Nov 14 '19 at 07:05
0

I tried all the suggestions and nothing really worked consistently.

If I set one input to autocomplete="nope" it works.

If I set two or more it breaks them all.

If I set two to autocomplete="nope" and autocomplete="no" it works on those two but breaks again if I do anything to a 3rd.

My form only has 3 inputs. I just set email and phone and left name alone. That pretty much solves my problem.

I have some jquery validation that pretty much does not work with autocomplete and this client really does not want to be bothered with junk emails.

Also Chrome treats a one row textarea exactly the same as a input.