Text widget with autocomplete="off"


We have noticed in production that users completing many edit forms (like 10000 by year) result to a very slow Firefox instance.
Indeed Firefox (by default) stores form inputs to do autocompletion in input text... leading sometimes to freeze the navigator.
What about the idea to have an autocomplete attribute on the text widget in z3c.form ? that could be set to "off" with autoform directives by example.



nice catch!
that sounds like a good addition to z3c.form (submit a PR) - but also like a good bug report for firefox. filling out forms should better not bring firefox's performance down...


I was just looking for this autocomplete=off feature in z3c.form because of the mail control panel in core Plone:

When users with access go to the mail control panel and the smtp_userid/smtp_pass is not filled in (because for example you can relay through localhost) some browsers like Chrome will autocomplete insert some username. Then they press save and .... the mail settings for the Plone site are broken.

Checking online docs I see multiple suggestions for disabling autocomplete, putting an attribute autocomplete='off' on the field and/of adding a hidden field autocomplete in the form with value 'off' And that some browsers might ignore the attribute/field at all though :frowning:

the per widget/field could maybe be added to plone.autoform so you can do something like:
from plone.autoform import directives as form

form.widget('smtp_userid', autocomplete='off')
smtp_userid = schema.TextLine(

But I only know of the 'klass' named parameter being support/documented at the moment, you cannot inject random other attributes onto the input tag, or does that depend on the Widget class?