Skip to content

Instantly share code, notes, and snippets.

@ianjosephwilson
Last active January 2, 2016 16:29
Show Gist options
  • Save ianjosephwilson/8330653 to your computer and use it in GitHub Desktop.
Save ianjosephwilson/8330653 to your computer and use it in GitHub Desktop.
broken form helpers
{% macro form_error(key, errors) -%}{%- endmacro %}
{% macro form_input(key, values, errors=None, label=None, type='text') %}
<div class="form-group{{' error' if errors and key in errors else ''}}">
<label class="form-label">{{ label or key.replace('_', ' ').title() }}</label>
<input type="{{ type }}" name="{{ key }}"
value="{{ values.get(key, '') }}"
class="form-control">
{% form_error(key, errors) %}
</div>
{% endmacro %}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment