Skip to content
Snippets Groups Projects
Unverified Commit 67b08c81 authored by Todd Dembrey's avatar Todd Dembrey Committed by GitHub
Browse files

Merge pull request #45 from OpenTechFund/feature/121-form-errors

Add non-field errors to the forms
parents f9997d71 2ab2b45d
No related branches found
No related tags found
No related merge requests found
{% extends "base.html" %} {% extends "base.html" %}
{% load wagtailcore_tags %} {% load wagtailcore_tags %}
{% block content %} {% block content %}
<h1>{{ page.title }}</h1> <h1>{{ page.title }}</h1>
<form action="{% pageurl page %}" method="POST"> <form action="{% pageurl page %}" method="POST">
{% csrf_token %} {% csrf_token %}
{% if form.errors or form.non_field_errors %}
<div class="messages">
There were some errors with your form. Please amend the fields highlighted below. {% if form.non_field_errors %}
<ul>
{% for error in form.non_field_errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %}
{{ form.as_p }} {{ form.as_p }}
<input type="submit"> <input type="submit">
</form> </form>
......
...@@ -18,8 +18,17 @@ ...@@ -18,8 +18,17 @@
<div> <div>
{% csrf_token %} {% csrf_token %}
{% if form.errors %} {% if form.errors or form.non_field_errors %}
There were some errors with your form. Please amend the fields highlighted below. <div class="messages">
There were some errors with your form. Please amend the fields highlighted below.
{% if form.non_field_errors %}
<ul>
{% for error in form.non_field_errors %}
<li class="error">{{ error }}</li>
{% endfor %}
</ul>
{% endif %}
</div>
{% endif %} {% endif %}
{% for field in form %} {% for field in form %}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment