I have 2 fields on my system.xml.
The first one is an authentication key (obscured).
The second one is an email.
The thing is, because I use my email & it's also saved in my browser with a password, Chrome autofills my password into the first field, even after I save the right key it loads the form with the saved password from the browser.
Here is an example screenshot of what I mean:
Example Screenshot

-- Any idea?

1 Answer 1


You can achieve this by adding the 'autocomplete=off' attribute to your input. You're going to need to create a frontend model and add it to your fields in the system.xml

NoAutoComplete.php (frontend model)


namespace Vendor\CustomModule\Model\Frontend;

class NoAutoComplete extends \Magento\Config\Block\System\Config\Form\Field
    @param  \Magento\Framework\Data\Form\Element\AbstractElement $element
    Output : return string
    protected function _getElementHtml(\Magento\Framework\Data\Form\Element\AbstractElement $element)
        $html = '<input id="' . $element->getHtmlId() .
                '" name="' . $element->getName() .
                '" autocomplete="off" />';

        return $html;


   <field id="credentials" translate="label" type="text" sortOrder="1" >
  • Already tried that, it doesn't work, the browser ignores the autocomplete attribute & fills out the field anyway. I actually suspect that this issue is related to Chrome more than to Magento.
    – Pini
    Mar 11, 2019 at 11:18
  • It seems that certain browsers ignore the autocomplete attribute for password fields. More info here: caniuse.com/#search=autocomplete Mar 11, 2019 at 11:26
  • Yes, leaving this question opened in case someone have a good idea for a workaround (I thought of adding 2 fake hidden fields at the beginning of the form so Chrome will have something else to autofill...)
    – Pini
    Mar 11, 2019 at 11:39

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

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