No announcement yet.
  • Filter
  • Time
Clear All
new posts

    disabling autocomplete in Chrome


    I have problem fighting with autocomplete in Chrome. Obviously using autocomplete="off" is ignored and people try to find workarounds. Using autocomplete="none" as in SmartClient stopped working for me and I have found out that - when autocomplete attribute is set to some other string that Chrome does not recognize as valid value according to HTML- it still can show autocomplete popup based on "name" attribute for HTML input.

    I have found out that removing "name" attribute from TextItems' <input> elements doesn't help as the entered value is also saved and used for other inputs with empty name.
    At the moment the only way I have found is to make name atribute unique with some large random number ( so it's unlikely it is reused in the other form even on the next page view.

    Please consider creating unique "name"s for inputs to disable autocomplete in Chrome.

    Best regards,

    From what we're reading, it would potentially work to set the native autocomplete attribute to a random value, which could be done via formItem.autoCompleteKeywords. Please see if that works for your case.

    As far as your suggested solution, just to clarify, we think you are saying that you would specify some new formItem property like "forceChromeAutoCompleteOff", and we would implement this by assigning random values for the HTML name attribute, but still making your FormItem store its values under the assigned

    Is that correct?


      Yes, I have read those answers as well. According to "Chrome will attempt to infer autofill behavior from name, id and any text content it can get surrounding the field including labels and arbitrary text nodes", so putting random string in autocomplete attribute using SmartClient autoCompleteKeywords no longer works.

      It is enough for Chrome to get an Enter key when focus is on specific <input> to save the typed string for autocomplete, which happens often with ComboBoxItem (addUnknownValues == false), when you use Enter to select one of the values.
      My suggestion was exactly that - making name attribute in generated input random - but if you feel that this is correct then implementing "forceChromeAutoCompleteOff" might be right. I have quickly browsed through source code, but did not find a place where HTML "name" attribute is used in DynamicForms, so always generating random value without a flag can also be an option.
      Removing HTML "name" attribute is also possible, however it will make Chrome use probably other context information to decide about autocomplete, so it may popup from time to time. If older IE that you claim to support can accept <input>s having no "name"s that you can just leave "name"s for DynamicForms that would be submitted with canSubmit == true.

      I have modified all my ListGrid editors where I have seen the problems to have getElementName include and for now it have solved the problem for now.


        We are aware that Chrome uses other heuristics, however, when you provide a value for autocomplete, you are explicitly telling the browser to store and retrieve autoCompletions from that particular keyword. If that did not work, it seems like general auto-completion behavior would be broken in Chrome. Instead, everyone else seems to say that this works - have you actually tested it?