How to turn off html input form field suggestions?

HtmlForm Fields

Html Problem Overview


By suggestions I mean the drop down menu appear when you start typing, and it's suggestions are based on what you've typed before:

Example

for example when I type 'a' in title field, it will give me a ton of suggestions which is pretty annoying.Does anyone know how to turn that off? Thanks in advance.

Html Solutions


Solution 1 - Html

What you want is to disable HTML autocomplete Attribute.

> Setting autocomplete="off" here has two effects: > > It stops the browser from saving field data for later autocompletion > on similar forms though heuristics that vary by browser. It stops the > browser from caching form data in session history. When form data is > cached in session history, the information filled in by the user will > be visible after the user has submitted the form and clicked on the > Back button to go back to the original form page.

Read more on MDN Network

Here's an example how to do it.

<form action="#" autocomplete="on">
  First name:<input type="text" name="fname"><br> 
  Last name: <input type="text" name="lname"><br> 
  E-mail: <input type="email" name="email" autocomplete="off"><br>
  <input type="submit">
</form>

If it's on React framework then use as follows:

<input
    id={field.name}
    className="form-control"
    type="text"
    placeholder={field.name}
    autoComplete="off"
    {...fields}/>

Link to react docs

Update

Here's an update to fix some browsers skipping "autocomplete=off" flag.

<form action="#" autocomplete="off">
  First name: <input type="text" name="fname" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"><br> Last name: <input type="text" name="lname" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"><br> E-mail:
  <input type="email" name="email" autocomplete="off" readonly onfocus="this.removeAttribute('readonly');"><br>
  <input type="submit">
</form>

Solution 2 - Html

On Chrome, the only method we could identify which prevented all form fills was to use autocomplete="new-password". Apply this on any input which shouldn't have autocomplete, and it'll be enforced (even if the field has nothing to do with passwords, e.g. SomeStateId filling with state form values). See this link on the Chromium bugs discussion for more detail.

Note that this only consistently works on Chromium-based browsers and Safari - Firefox doesn't have special handlers for this new-password (see this discussion for some detail).

Update: Firefox is coming aboard! Nightly v68.0a1 and Beta v67.0b5 (3/27/2019) feature support for the new-password autocomplete attribute, stable releases should be coming on 5/14/2019 per the roadmap.

Solution 3 - Html

use autocomplete="off" attribute

Quote:IMPORTANT > Put the attribute on the <input> element, > NOT on the <form> element

Solution 4 - Html

I know it's been a while but if someone is looking for the answer this might help. I have used autocomplete="new-password" for the password field. and it solved my problem. Here is the MDN documentation.

Solution 5 - Html

Adding the two following attributes turn off all the field suggestions (tested on Chrome v85, Firefox v80 and Edge v44):

<input type="search" autocomplete="off">

Solution 6 - Html

autocomplete = "new-password" does not work for me.

I built a React Form. Google Chrome will autocomplete the form input based on the name attribute.

 <input 
  className="scp-remark" 
  type="text" 
  name="remark"
  id='remark'
  value={this.state.remark} 
  placeholder="Remark" 
  onChange={this.handleChange} 
/>

It will base on the "name" attribute to decide whether to autofill your form. In this example, name: "remark". So Chrome will autofill based on all my previous "remark" inputs.

<input 
  className="scp-remark" 
  type="text" 
  name={uuid()} //disable Chrome autofill
  id='remark'
  value={this.state.remark} 
  placeholder="Remark" 
  onChange={this.handleChange} 
/>

So, to hack this, I give name a random value using uuid() library.

import uuid from 'react-uuid';

Now, the autocomplete dropdown list will not happen. I use the id attribute to identify the form input instead of name in the handleChange event handler

handleChange = (event) => {
    const {id, value} = event.target;
    this.setState({
        [id]: value,
    })
}

And it works for me.

Solution 7 - Html

I had similar issue but I eventually end up doing

<input id="inp1" autocomplete="off" maxlength="1" /> i.e., autocomplete = 'off' and suggestions will be disappeared.

Solution 8 - Html

I ended up changing the input field to

<textarea style="resize:none;"></textarea>

You'll never get autocomplete for textareas.

Solution 9 - Html

If you are using ReactJS. Then make this as autoComplete="off"

<input type="text" autoComplete="off" />

Solution 10 - Html

<input type="text" autocomplete="off"> is in fact the right answer, though for me it wasn't immediately clear.

According to MDN:

> If a browser keeps on making suggestions even after setting > autocomplete to off, then you have to change the name attribute of the > input element.

The attribute does prevent the future saving of data but it does not necessarily clear existing saved data. Thus, if suggestions are still being made even after setting the attribute to "off", either:

  • rename the input
  • clear existing data entries

Additionally, if you are working in a React context the attribute naturally becomes autoComplete.

Cheers!

Attributions

All content for this solution is sourced from the original question on Stackoverflow.

The content on this page is licensed under the Attribution-ShareAlike 4.0 International (CC BY-SA 4.0) license.

Content TypeOriginal AuthorOriginal Content on Stackoverflow
QuestionJosephView Question on Stackoverflow
Solution 1 - HtmlCodeMonkeyView Answer on Stackoverflow
Solution 2 - HtmlbsplosionView Answer on Stackoverflow
Solution 3 - HtmlGigo_GView Answer on Stackoverflow
Solution 4 - HtmlAlisher MusurmonvView Answer on Stackoverflow
Solution 5 - HtmlThierry MarchandView Answer on Stackoverflow
Solution 6 - HtmlDave ChongView Answer on Stackoverflow
Solution 7 - HtmlAryeshView Answer on Stackoverflow
Solution 8 - HtmlPeter BView Answer on Stackoverflow
Solution 9 - Htmltalha_ahView Answer on Stackoverflow
Solution 10 - HtmlqslabsView Answer on Stackoverflow