# HG changeset patch # User Alain Begey # Date 1397509219 -7200 # Node ID a6834e2dcc1bb30a142f7a621edfdbe06bdbb100 # Parent c44224387028c70a377e582696bd506d4078ea21 [forms] Add autocomplete attribute for formrenderers If you set form.autocomplete = False, the form renderer in the open form tag will add the html option 'autocomplete=off'. It allows to disable the functionality of some browsers to fill in some forms automatically (for instance a profile with login/password) Closes #3747294 diff -r c44224387028 -r a6834e2dcc1b web/views/formrenderers.py --- a/web/views/formrenderers.py Fri Apr 11 17:43:26 2014 +0200 +++ b/web/views/formrenderers.py Mon Apr 14 23:00:19 2014 +0200 @@ -202,6 +202,8 @@ attrs.setdefault('class', form.cssclass) if form.cwtarget: attrs.setdefault('cubicweb:target', form.cwtarget) + if not form.autocomplete: + attrs.setdefault('autocomplete', 'off') return '
' % uilib.sgml_attributes(attrs) def close_form(self, form, values): diff -r c44224387028 -r a6834e2dcc1b web/views/forms.py --- a/web/views/forms.py Fri Apr 11 17:43:26 2014 +0200 +++ b/web/views/forms.py Mon Apr 14 23:00:19 2014 +0200 @@ -111,6 +111,9 @@ :attr:`fieldsets_in_order` sequence of fieldset names , to control order + :attr:`autocomplete` + set to False to add 'autocomplete=off' in the form open tag + **Generic methods** .. automethod:: cubicweb.web.form.Form.field_by_name(name, role=None) @@ -160,6 +163,7 @@ form_buttons = None form_renderer_id = 'default' fieldsets_in_order = None + autocomplete = True @property def needs_multipart(self):