Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Disable auto-suggestions in individual input fields in Chrome based on history

On HTML inputs in Chrome, how can the autofill be disabled for individual fields?

See the image below to see the issue. I'm using the Date/Time dropdown for bootstrap (but this can be for any plugin)

Chrome seems to cache the previously entered input when the form is submitted. So when the user comes back to the page again, this creates a UX issue.

Sample Image

What I've tried so far,

<input type="text" class="form-control js-datetime-picker" autocomplete="new-field">

<input type="text" class="form-control js-datetime-picker" autocomplete="off">

<input type="text" class="form-control js-datetime-picker" autocomplete="false">

How can the auto-suggestions be disabled for a single field (not the whole form)?

UPDATE: Since posting, I've found out this is a bug (branded as a feature) on Chrome, and the discussion is ongoing. If anyone has a solution, without using additional hidden fields or Javascript, please share.

https://bugs.chromium.org/p/chromium/issues/detail?id=587466

like image 253
shanecp Avatar asked Apr 24 '19 02:04

shanecp


People also ask

How do I turn off auto suggestions input field?

Use the <input> tag with autocomplete attribute. Set the autocomplete attribute to value “off”.


1 Answers

On the form parent of the input elements (add one if there isnt one already) add this autocomplete='off' and then on the inputs add autocomplete='false'.

And to answer your question, 'can individual fields be disabled without the whole form' Yes. But you would need to add another form onto the child element.

Cheers.

like image 190
Dat Boi Avatar answered Sep 22 '22 10:09

Dat Boi