Announcement

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

    disabling autocomplete in Chrome

    Hi,

    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 (Date.now()) 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,
    Janusz

    #2
    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 formItem.name.

    Is that correct?

    Comment


      #3
      Yes, I have read those answers as well. According to https://stackoverflow.com/questions/...76223#30976223 "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 Date.now and for now it have solved the problem for now.

      Comment


        #4
        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?

        Comment

        Working...
        X