I'd like to know how can I add .error class to input elements (to registration app) when the form validation fails.
A:
This can be done completely through your template.
You build the form template for each form field that you want to test you can use the following example construct
<input type="text" class="reg-txt{% if form.fieldname.errors %} errors{% endif %}"/>
This lets you provide the interface you want without modifying the view & django form code.
wlashell
2010-02-11 05:43:24
Is there anything that can be done on the form or widget level? This seems rather verbose, I would want to have this error class on every invalid input field, textarea, select...
Frank Malina
2010-09-22 23:06:28
A:
(Better late than never)
You should be able to do this with Django Uni Form
Gumbah
2010-10-15 16:03:35