changeset 1219:00895808c0af

Fixed HTML validation errors on user settings page.
author Julian Brost <julian.brost@googlemail.com>
date Sat, 07 Jan 2012 23:53:01 +0100
parents 959fc2a35823
children cb16a89fcd49
files MoinMoin/templates/forms.html MoinMoin/templates/usersettings_forms.html
diffstat 2 files changed, 12 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/MoinMoin/templates/forms.html	Thu Dec 29 19:10:01 2011 +0100
+++ b/MoinMoin/templates/forms.html	Sat Jan 07 23:53:01 2012 +0100
@@ -20,7 +20,17 @@
     {{ gen.label(field) }}
   </dt>
   <dd>
-    {{ gen.input(field, type=field_type) }}
+    {% if field_type == 'checkbox' %}
+      {#
+      Flatland adds the value to the ID of checkboxes which we do not want as
+      the for attributes of the labels will point to a non-existent ID in that
+      case. To fix this we manually generate the ID for checkboxes here.
+      related issue in flatland: https://bitbucket.org/jek/flatland/issue/9
+      #}
+      {{ gen.input(field, type='checkbox', id='f_' + field.flattened_name()) }}
+    {% else %}
+      {{ gen.input(field, type=field_type) }}
+    {% endif %}
     {{ render_errors(field) }}
   </dd>
 {% endmacro %}
--- a/MoinMoin/templates/usersettings_forms.html	Thu Dec 29 19:10:01 2011 +0100
+++ b/MoinMoin/templates/usersettings_forms.html	Sat Jan 07 23:53:01 2012 +0100
@@ -50,7 +50,7 @@
     {{ forms.render_select(gen, form['theme_name']) }}
     {{ forms.render_field(gen, form['css_url'], 'url') }}
     {{ forms.render_field(gen, form['edit_rows'], 'text') }}
-    {{ forms.render_field(gen, form['results_per_page'], 'number') }}
+    {{ forms.render_field(gen, form['results_per_page'], 'text') }}
 </dl>
 {{ forms.render_hidden('part', 'ui') }}
 {{ forms.render_button(_("Save")) }}