0

I have a lightning-input with type="search". I am having trouble to set autocomplete="off" to be able to disable autocomplete functionality of modern browsers like Chrome.

Any help on this is appreciated!

Thank you!

put on hold as off-topic by Pranay Jaiswal, glls, Sebastian Kessel, battery.cord, Lukas Lunow May 17 at 15:08

This question appears to be off-topic. The users who voted to close gave this specific reason:

  • "Programming questions not specific to Salesforce are off-topic here, but can be asked on Stack Overflow." – Pranay Jaiswal, glls, Sebastian Kessel, battery.cord, Lukas Lunow
If this question can be reworded to fit the rules in the help center, please edit the question.

  • 2
    sounds like your are looking to disable the browser "Autofill" functionality rather than an input field autocomplete ? – glls Apr 16 at 19:19
  • 2
    lightning-input does not have an autocomplete attribute (as far as the docuemntation goes) – glls Apr 16 at 19:20
  • @glls well, we can't ask every client to disable that functionality for all their users can we? – Selcuk Apr 16 at 20:35
  • considering that this is a browser setting - they really dont have a choice – glls Apr 16 at 20:36
  • Possible duplicate of How to set autocomplete="off" in lightning form – shmuels May 16 at 12:37
1

To switch off browser autofill, try html-autocomplete="nope" Chrome ignores autocomplete="off" but assigning a random string like nope works sometimes.

Alternatively, see MDN docs for disabling autocomplete. The last section describes jquery.disableAutoFill which could be another way of disabling autocomplete.

Not the answer you're looking for? Browse other questions tagged or ask your own question.