Browse Source

Highlight inputs if they are empty but required

pull/160/head
ariannedee 5 years ago
parent
commit
2bd1e420fa
1 changed files with 7 additions and 0 deletions
  1. +7
    -0
      edivorce/apps/core/templatetags/input_field.py

+ 7
- 0
edivorce/apps/core/templatetags/input_field.py View File

@ -63,6 +63,13 @@ def input_field(context, type, name='', value='', multiple='', **kwargs):
"""
Usage: when specifying data attributes in templates, use "data_" instead of "data-".
"""
error = context.get(f'{name}_error', False)
if error:
if 'class' in kwargs:
kwargs['class'] += ' error'
else:
kwargs['class'] = 'error'
if type == "textarea":
attributes = additional_attributes(**kwargs)
if value == '':


Loading…
Cancel
Save