Commit 058b2083 authored by Daniel Klaffenbach's avatar Daniel Klaffenbach 🐍

tuc2014.forms: Link help texts to form field through "aria-describedby"

parent 324502c5
Pipeline #28181 passed with stage
in 13 seconds
......@@ -33,6 +33,10 @@ class TucFormMixin(object):
else:
self.fields[field].widget.attrs['aria-required'] = 'false'
# If a field has a help_text, link it to the field through ARIA attribute
if self.fields[field].help_text:
self.fields[field].widget.attrs['aria-describedby'] = 'hint_id_{}'.format(field)
def add_crispy_attributes(self):
"""
Initializes the crispy_forms FormHeler() with default values.
......@@ -40,7 +44,7 @@ class TucFormMixin(object):
@see: http://django-crispy-forms.readthedocs.org/en/latest/form_helper.html
"""
self.helper = FormHelper(self)
#self.helper.html5_required = True
# self.helper.html5_required = True
self.helper.form_method = 'post'
self.helper.form_action = '.'
self.helper.form_class = 'form-horizontal tuc-form'
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment