[date picker widgets] properly distinguish DOM id and input name. Closes #3096575 stable
authorSylvain Thénault <sylvain.thenault@logilab.fr>
Wed, 28 Aug 2013 11:36:44 +0200
branchstable
changeset 9223 233e770293a9
parent 9222 ec65ca70aac9
child 9224 5c6d6a9f4fc8
[date picker widgets] properly distinguish DOM id and input name. Closes #3096575
web/formwidgets.py
--- a/web/formwidgets.py	Wed Aug 28 11:29:58 2013 +0200
+++ b/web/formwidgets.py	Wed Aug 28 11:36:44 2013 +0200
@@ -692,16 +692,17 @@
                        '{buttonImage: "%s", dateFormat: "%s", firstDay: 1,'
                        ' showOn: "button", buttonImageOnly: true})' % (
                            domid, req.uiprops['CALENDAR_ICON'], fmt))
-        return self._render_input(form, field, domid)
+        return self._render_input(form, field)
 
-    def _render_input(self, form, field, domid):
+    def _render_input(self, form, field):
         if self.value is None:
             value = self.values(form, field)[0]
         else:
             value = self.value
         attrs = self.attributes(form, field)
         attrs.setdefault('size', unicode(self.default_size))
-        return tags.input(name=domid, value=value, type='text', **attrs)
+        return tags.input(name=field.input_name(form, self.suffix),
+                          value=value, type='text', **attrs)
 
 
 class JQueryTimePicker(JQueryDatePicker):
@@ -721,7 +722,7 @@
         domid = field.dom_id(form, self.suffix)
         form._cw.add_onload(u'$("#%s").timePicker({step: %s, separator: "%s"})' % (
                 domid, self.timesteps, self.separator))
-        return self._render_input(form, field, domid)
+        return self._render_input(form, field)
 
 
 class JQueryDateTimePicker(FieldWidget):