Problem to style form fields with error

69 görüntüleme
İlk okunmamış mesaja atla

Guido Luis Dalla Vecchia

okunmadı,
24 Nis 2024 20:15:2724 Nis
alıcı Django users
Hello! I'm building my first website with Django and I've been stuck for the past two months with a problem I can't figure out.
My website has a form with three fields that allow the user to input his first name, last name and email.
In my "forms.py" file, I've declared "clean" methods for each field, that add the "error" class to them if they don't pass the validation.
In my CSS file, I declared a rule that applies the "background-color: lightcoral" to all elements with the class ".error".
The problem is that, when I fill in the "last name" field with invalid data, the "first name" field gets marked as invalid too.
I've tried everything I could think of, and nothing has worked. It's driving me crazy!! Has anyone ever seen something like this?

Pleas help!!!

Ryan Nowakowski

okunmadı,
25 Nis 2024 10:36:0325 Nis
alıcı django...@googlegroups.com
Can you share some code snippets?

Guido Luis Dalla Vecchia

okunmadı,
25 Nis 2024 18:39:3825 Nis
alıcı Django users
Here I attach the relevant parts of the files "views.py", "index.html" and "forms.py" so you can check them out.

Thanks!

views.py
index3.html
forms.py
Tümünü yanıtla
Yazarı yanıtla
Yönlendir
0 yeni ileti