fix password widget: do not duplicate dom id, fix confirm field name tls-sprint
authorsylvain.thenault@logilab.fr
Thu, 12 Mar 2009 20:45:39 +0100
branchtls-sprint
changeset 1110 c71997f514ba
parent 1109 9e472941abd4
child 1111 bcb81e7c41bc
fix password widget: do not duplicate dom id, fix confirm field name
web/formwidgets.py
--- a/web/formwidgets.py	Thu Mar 12 20:45:13 2009 +0100
+++ b/web/formwidgets.py	Thu Mar 12 20:45:39 2009 +0100
@@ -70,9 +70,11 @@
         self.add_media(form)
         name, values, attrs = self._render_attrs(form, field)
         assert len(values) == 1
-        inputs = [tags.input(name=name, value=values[0], type=self.type, **attrs),
+        id = attrs.pop('id')
+        confirmname = '%s-confirm:%s' % tuple(name.rsplit(':', 1))
+        inputs = [tags.input(name=name, value=values[0], type=self.type, id=id, **attrs),
                   '<br/>',
-                  tags.input(name=name+'-confirm', type=self.type, **attrs),
+                  tags.input(name=confirmname, type=self.type, **attrs),
                   '&nbsp;', tags.span(form.req._('confirm password'),
                                       **{'class': 'emphasis'})]
         return u'\n'.join(inputs)