321 def _render_fields(self, fields, w, form): |
321 def _render_fields(self, fields, w, form): |
322 if form.is_subform: |
322 if form.is_subform: |
323 entity = form.edited_entity |
323 entity = form.edited_entity |
324 values = form.form_previous_values |
324 values = form.form_previous_values |
325 qeid = eid_param('eid', entity.eid) |
325 qeid = eid_param('eid', entity.eid) |
326 cbsetstate = "setCheckboxesState2('eid', %s, 'checked')" % xml_escape(dumps(entity.eid)) |
326 cbsetstate = "setCheckboxesState2('eid', %s, 'checked')" % \ |
|
327 xml_escape(dumps(entity.eid)) |
327 w(u'<tr class="%s">' % (entity.row % 2 and u'even' or u'odd')) |
328 w(u'<tr class="%s">' % (entity.row % 2 and u'even' or u'odd')) |
328 # XXX turn this into a widget used on the eid field |
329 # XXX turn this into a widget used on the eid field |
329 w(u'<td>%s</td>' % checkbox('eid', entity.eid, checked=qeid in values)) |
330 w(u'<td>%s</td>' % checkbox('eid', entity.eid, |
|
331 checked=qeid in values)) |
330 for field in fields: |
332 for field in fields: |
331 error = form.form_field_error(field) |
333 error = form.form_field_error(field) |
332 if error: |
334 if error: |
333 w(u'<td class="error">') |
335 w(u'<td class="error">') |
334 w(error) |
336 w(error) |
335 else: |
337 else: |
336 w(u'<td>') |
338 w(u'<td>') |
337 if isinstance(field.widget, (fwdgs.Select, fwdgs.CheckBox, fwdgs.Radio)): |
339 if isinstance(field.widget, (fwdgs.Select, fwdgs.CheckBox, |
|
340 fwdgs.Radio)): |
338 field.widget.attrs['onchange'] = cbsetstate |
341 field.widget.attrs['onchange'] = cbsetstate |
339 elif isinstance(field.widget, fwdgs.Input): |
342 elif isinstance(field.widget, fwdgs.Input): |
340 field.widget.attrs['onkeypress'] = cbsetstate |
343 field.widget.attrs['onkeypress'] = cbsetstate |
|
344 # XXX else |
341 w(u'<div>%s</div>' % field.render(form, self)) |
345 w(u'<div>%s</div>' % field.render(form, self)) |
342 w(u'</td></tr>') |
346 w(u'</td></tr>') |
343 else: |
347 else: |
344 self._main_display_fields = fields |
348 self._main_display_fields = fields |
345 subfields = [field for field in form.forms[0].fields |
349 subfields = [field for field in form.forms[0].fields |