Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

suppress form field errors in Django

I have my form (code below) – it’s working perfectly. But it’s showing the form field errors, even before it’s been submitted (on page load!).

Is there a way to supress the errors, if the form hasn’t been submitted?

<form method="post">
  {% csrf_token %}
  {% for field in form %}
    <p>
<font color = 'white'>{{ field.label_tag }}</font>
<br>{{ field }}
      {% if field.help_text %}
        <small style="color: grey">{{ field.help_text }}</small>
      {% endif %}
      {% for error in field.errors %}
  <p style="color: red">{{ error }}</p>
        {% endfor %}
    </p>
  {% endfor %}
  <button type="submit">Sign up</button>
</form>

enter image description here

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

This page really explains your problem you are getting.
Do read this.
Solution Link

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading