Skip to content
Browse files

better form feedback

  • Loading branch information...
1 parent 3ad34e0 commit a5cb3a0efb46b812fb0ef93a1aa21d9431d4c83b @evildmp committed Mar 8, 2013
Showing with 44 additions and 33 deletions.
  1. +44 −33 arkestra_utilities/templates/html/formdefinition/forms/custom.html
View
77 arkestra_utilities/templates/html/formdefinition/forms/custom.html
@@ -1,37 +1,48 @@
{% load friendly %}
-<form class="arkestra-form" name="{{ form_definition.name }}" action="{{ form_definition.action }}" method="{{ form_definition.method }}" enctype="multipart/form-data">
- {% if messages %}
- <h{{ IN_BODY_HEADING_LEVEL }}>Response</h{{ IN_BODY_HEADING_LEVEL }}>
- {{ messages.success }}
- {% for message in messages %}
- <p><strong>{{message}}</strong></p>
- {%endfor %}
- {% endif %}
- {% for entry in logs %}
- <h{{ IN_BODY_HEADING_LEVEL }}>Your submission</h{{ IN_BODY_HEADING_LEVEL }}>
- {% for field in entry.data %}
- <p>
- <label for="">{{ field.label }}</label>
- {{ field.value|friendly }}
- </p>
- {% endfor %}
- {% endfor %}
- {% for field in form %}
- {% if not field.is_hidden %}
- {{ field.errors }}
- <p class="field {% if field.errors %}errors{% endif %}{% if field.field.required %}{% if field.errors %} {% endif %}required{% endif %}">
- <label for="{{ field.auto_id }}">{{ field.label }} {{field.field.required|yesno:"(required),"}}</label>
- {{ field }}
+{% if form_success %}
+ <h{{ IN_BODY_HEADING_LEVEL }}>Response</h{{ IN_BODY_HEADING_LEVEL }}>
+ {% for message in messages %}
+ <p>{{message}}</p>
+ {%endfor %}
+
+{% else %}
+
+ <form class="arkestra-form" name="{{ form_definition.name }}" action="{{ form_definition.action }}" method="{{ form_definition.method }}" enctype="multipart/form-data">
+ {% if messages %}
+ <h{{ IN_BODY_HEADING_LEVEL }}>Response</h{{ IN_BODY_HEADING_LEVEL }}>
+ {% for message in messages %}
+ <p><strong>{{message}}</strong></p>
+ {%endfor %}
+ {% endif %}
+
+ {% for entry in logs %}
+ <h{{ IN_BODY_HEADING_LEVEL }}>Your submission</h{{ IN_BODY_HEADING_LEVEL }}>
+ {% for field in entry.data %}
+ <p>
+ <label for="">{{ field.label }}</label>
+ {{ field.value|friendly }}
</p>
- {% endif %}
- {% endfor %}
+ {% endfor %}
+ {% endfor %}
+
+ {% for field in form %}
+ {% if not field.is_hidden %}
+ {{ field.errors }}
+ <p class="field {% if field.errors %}errors{% endif %}{% if field.field.required %}{% if field.errors %} {% endif %}required{% endif %}">
+ <label for="{{ field.auto_id }}">{{ field.label }} {{field.field.required|yesno:"(required),"}}</label>
+ {{ field }}
+ </p>
+ {% endif %}
+ {% endfor %}
- <p class="buttons">
- {% include "html/formdefinition/forms/includes/submit.html" %}
- </p>
- {% for field in form.hidden_fields %}
- {{ field }}
- {% endfor %}
- {% csrf_token %}
-</form>
+ <p class="buttons">
+ {% include "html/formdefinition/forms/includes/submit.html" %}
+ </p>
+ {% for field in form.hidden_fields %}
+ {{ field }}
+ {% endfor %}
+ {% csrf_token %}
+ </form>
+
+{% endif %}

0 comments on commit a5cb3a0

Please sign in to comment.
Something went wrong with that request. Please try again.