Looping through custom checkbox in mail template.

SiSo
Member

Hello,

 

I've just got a problem with the templating engine.

 

So I have a custom contact property which is a checkbox so the user can have one or more options.

 

In my email template I want to

 

1. Check if the user has set this property

2. Check how many options are selected

3. Looping through each option and printing it.

 

What I get in my mail template is:

{{ contact.recommended_add_ons|pprint }}

(String: Option1, Option2, Option3, Option4)

 

if I do:

{{ contact.recommended_add_ons|split(',') }}

[Option1, Option2, Option3, Option4]

 

And if I now loop to this (PyList) I get this:

{% for v in contact.recommended_add_ons|split(',')  %}

  {{ v }}<br>

{% endfor %}

Option1, Option2, Option3, Option4

 

And if I do:

{{ contact.recommended_add_ons|lenght }}

I get 31But the real options are in reality 75 characters long.

 

Does anyone have/had the same problem.

 

Thank you

 

Simon

0 Upvotes
2 Replies 2
SiSo
Member

 No one?

0 Upvotes
SiSo
Member

.

0 Upvotes