Support

Account

Home Forums Front-end Issues Multiple empty tags on a simple text field

Solved

Multiple empty tags on a simple text field

  • I have the following in my twig template (inside a repeater loop):

    <h3>
    {% for therapist_full_title in item %}
    <b>{{ therapist_full_title.therapist_name }}</b>
    {{ therapist_full_title.therapist_accreditation }}
    {% endfor %}
    <br/>{{ item.therapist_title }}
    </h3>

    This outputs:
    <h3> <b></b>
    <b>foo</b>
    bar <b></b> <b></b>
    <br/><p>asdf</p>
    </h3>

    (edited as code strips out the extra empty tags!)

    Where are those 3 extra sets of <br> tags coming from?

  • I figured out that tags need to be added outside the for loop, and each field can be wrapped in a separate for loop. Works as expected now.

    <h3>
    <b>
    {% for therapist_full_title in item %} {{ therapist_full_title.therapist_name }}
    {% endfor %}
    </b>
    {% for therapist_full_title in item %}
    {{ therapist_full_title.therapist_accreditation }}
    {% endfor %}
    </h3>

    (edit: code format was stripping out one of the fields)

Viewing 2 posts - 1 through 2 (of 2 total)

You must be logged in to reply to this topic.