Student Unions & Activities : University of Minnesota

Student Unions & Activities logo

Form Styles

Hidden Tag

Don't forget the hidden tag:

{{ form.hidden_tag() }}

The render_field Macro

Include the render_field macro at the top of your document:

{% from "forms/_helpers.html" import render_field %}

To consistently render a field, use the render_field macro like this:

{{ render_field(form.text_field) }}

This will generate code that looks something like this:

<p class="field text">
<label for="text_field">Text Field</label>
<input id="text_field" name="text_field" type="text" value="" placeholder="">

render_field Parameters

render_field accepts the following parameters:

type and p_class both do essentially the same thing. That is, they add a class to the p tag that contains the form field.

{{ render_field(form.boolean_field, type="checkbox") }}
<p class="field checkbox">
<label for="text_field">Text Field</label>
<input id="text_field" name="text_field" type="text" value="" placeholder="">

optional is a boolean value that adds and "optional" class in the same place is type and p_class.

help_text adds "help text" near the form field that is wrapped in small tags.

{{ render_field(form.event_time, help_text="(Enter \"All Day\" if your event is all day long.)") }}

Form Styles

Legend

EFS Number
EFS Number (Non-Sponsored Activity)
EFS Number (Sponsored Activity)
Conditional / Optional EFS Fields

This is the help text.