Liquid Guide: Idea Form Tag

ideaform tag


The ideaform tag is used like this:


  {% ideaform %}    
<p>Title: {{ form.title }}</p>
...
<p>{{ form.submit }}</p> {% endideaform %}

The tag will insert the FORM tag that will submit to the right URL. The form has an id ‘idea_form’.

Expects an object ‘idea’ to be in scope.

In addition, it provides an object, ‘form’ with the following attributes, which helps you build the form:

title


The title. Text field. Class is ‘text_field’, id is ‘idea_title’.

source_url


The source URL. Text field. Class is ‘text_field’, id is ‘idea_source_url’.

body


The body. Textarea, cols=40, rows=10. id is ‘idea_body’.

submit


A submit tag for the form, with class ‘submit_tag’, id ‘idea_submit’. The label is ‘Tell me!’.

errors


An object that lets you loop over and output the errors that prevented the idea from being submitted. You can ask it for how many errors there were using ‘form.errors.size’, and you can loop over them by saying {% for error in form.errors %}. Each element in your loop will be a string explaining one error.