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>
CodePudding user response:
This page really explains your problem you are getting. Do read this. Solution Link