Skip to content

Ability to customise field.label CSS #1002

Closed Answered by savchenko
savchenko asked this question in Q&A
Discussion options

You must be logged in to vote

Solved!

{% macro render_field_with_errors(field) %}
<div class="{{ kwargs.pop('divclass', '') }}" id="{{ field.id|default('fs-field') }}">
    {{ field(**kwargs)|safe }} {{ field.label }}
    {% if field.errors %}
    <ul>
        {% for error in field.errors %}<li class="fs-error-msg">{{ error }}</li>{% endfor %}
    </ul>
    {% endif %}
</div>
{% endmacro %}

Than you can do something like:

{{ render_field_with_errors(login_user_form.email, class="myclass", divclass="mydivclass", placeholder="[email protected]") }}

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by savchenko
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
1 participant