{% extends "admin/base_site.html" %} {% load i18n %} {% block bodyclass %}grp-doc{% endblock %} {% block content-class %}{% endblock %} {% block title %}Grappelli Documentation » Errors in Forms{% endblock %} {% block extrahead %} {% endblock %} {% block breadcrumbs %} {% endblock %} {% block content %}

Errors in Forms

Basics

There are basically two elements showing error-messages: p.errornote and ul.errorlist.

Note: Both elements are outside Grappellis namespace because they are hardcoded with Django.

Errornote

  • Errorlist
{% filter force_escape %}

Errornote

  • Errorlist
{% endfilter %}

Field Errors

A field-error requires to add .grp-errors to the element wrapping the respective label and form field. Below the erroneous form field, there's a ul.errorlist with li displaying the error-messages.

Module

  • Error with that form field

Helptext

{% filter force_escape %}

Module

  • Error with that form field

Helptext

{% endfilter %}

Non-Form & Non-Field Errors in Stacked Groups

They have to be placed directly after the groups/modules heading or directly after the tools if there are any.

Stacked Group

  • Non-Form Errorlist

Module

  • Non-Field Errorlist
  • Error with that form field

Non-Form & Non-Field Errors in Tabular Groups

The non-form errorlist has to be placed directly after the groups heading or directly after the tools if there are any. The non-field errorlist has to be the first child of the .grp-module.grp-tbody.

Tabular Group

  • Non-Form Errorlist
Table-Head 1
Table-Head 2
  • Non-Field Errorlist
  • Error with that form field
{% filter force_escape %}

Tabular Group

  • Non-Form Errorlist
Table-Head 1
Table-Head 2
  • Non-Field Errorlist
  • Error with that form field
{% endfilter %}

Errornote

The p.errornote is currently used before the very first group or module, e.g. with the change form.

Errornote

Module

  • Error with that form field

Helptext

{% filter force_escape %}

Errornote

Module

  • Error with that form field

Helptext

{% endfilter %}
{% endblock %}