Basic styling making form error messages look a little bit better.

This commit is contained in:
Magnus Hagander
2010-03-30 18:26:30 +02:00
parent 4ca5d45536
commit 323f25f02b
2 changed files with 35 additions and 1 deletions

View File

@ -644,6 +644,10 @@ TABLE.pgGenericFormTable TR TD INPUT {
width: 100%;
}
TABLE.pgGenericFormTable TR TD SELECT {
width: 100%;
}
TABLE.pgGenericFormTable TR TD TEXTAREA {
width: 100%;
}
@ -652,6 +656,21 @@ TABLE.pgGenericFormTable TR TD DIV.markdownpreview {
width: 100%;
}
TABLE.pgGenericFormTable TR.error {
background-color: red;
color: white;
}
TABLE.pgGenericFormTable TR.errorinfo {
background-color: #FFFFCC;
}
TABLE.pgGenericFormTable TR.errorheader TD {
background-color: #FFFFCC;
border: 1px solid red;
padding: 2px 2px 2px 2px;
}
/* Misc Classes */
.pgClearBoth {

View File

@ -9,7 +9,22 @@
{%endif%}
<table class="pgGenericFormTable">
{{form.as_table}}
{%if form.errors%}
<tr class="errorheader">
<td colspan="2">Please correct the errors below, and re-submit the form.</td>
</tr>
{%endif%}
{%for field in form%}
{%if field.errors %}
<tr class="error">
<td colspan="2">{{field.errors.as_ul}}</td>
</tr>
{%endif%}
<tr {%if field.errors%}class="errorinfo"{%endif%}>
<th>{{field.label_tag}}</th>
<td>{{field}}</td>
</tr>
{%endfor%}
</table>
<input type="submit" value="{{savebutton|default:"Save"}}">
</form>