Form

This object contains information about the form submission from the previous page (if a form was submitted). Usually the form redirects to the same page it was called from, so processing this object will do nothing if no form was submitted – otherwise it shows e.g. error messages from the last submission.

Variable name Object Description Note
errors Errors This sub-object contains information about problems on the last form submission. For further information please have a look at the Errors object.  
only_rating bool Only valid for review forms. If true, the submitted form had only a rating, but no real title/body textual information. EF
posted_successfully? bool If the form was posted successfully on the last page, this flag will be set to true  

Example:


{% form 'contact' %}
 {% if form.posted_successfully? %}
 Thank you for your input!
 {% else %}
{% if form.errors %}
  {{ form.errors | default_errors }}
{% endif %}
 <input type="text" name="contact[name]" />
 <input type="email" name="contact[email]" />
 <input type="text" name="contact[phone]" />
 <textarea name="contact[body]"></textarea>
 <input type="submit" value="Submit" />
 {% endif %}
{% endform %}

Output:


<form action="/" class="contact-form" accept-charset="UTF-8" method="post" enctype="multipart/form-data" id="contact_form">
<input name="formid" type="hidden" value="contact" id="contact_form_id" />
 Thank you for your input!
</form>