A
A
Artur Kudashev2019-01-24 17:04:55
Django
Artur Kudashev, 2019-01-24 17:04:55

How to put an error in a form field?

Hello, there is a form in the template

{% for field in form %}
   {{ field }}
{% endfor %}

I get input and textarea, and after sending, a check occurs and I want the error to fit in the placeholder of the input, but I don’t know how to implement this.

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
alternativshik, 2019-01-24
@alternativshik

It is necessary to typeset the input and insert the necessary data into it, and not insert the whole {{ field }}

V
Vadim Shatalov, 2019-01-24
@netpastor

https://docs.djangoproject.com/en/dev/topics/forms...
See here how to get to the error test to insert it into the placeholder

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question