Welcome to the LimeSurvey Community Forum

Ask the community, share ideas, and connect with other LimeSurvey users!

If Statement within unordered List

More
2 years 2 months ago #244491 by jaricianci
LimeSurvey version: Version 5.6.26+230613
Own server
==================

I want to add a list element within an unordered list using an if-statement. This does not seem to work. Other HTML Code within if-statements work fine so far:

<p>Title:</p>
<ul>
    <li>List element 1</li>
    <li>List element 2</li>
{if(TOKEN:ATTRIBUTE_1=="B",''<li>List element 3</li>,'')}
</ul>

Limesurvey auto adds list items to the code turning the above code to:

<p>Title:</p>
<ul>
    <li>List element 1</li>
    <li>List element 2</li>
    <li>{if(TOKEN:ATTRIBUTE_1=="B",''</li>
    <li>List element 3</li>
    <li>,'')}</li>
</ul>

Does anyone know how to correctly add a list item within an unordered list via if-statement?
Thanks for your help,



 

Please Log in to join the conversation.

More
2 years 2 months ago #244492 by tpartner
It is the editor doing that.

Use the editor in source mode (personal settings) or try placing your expression on the same line as the last list item.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The following user(s) said Thank You: jaricianci

Please Log in to join the conversation.

More
2 years 2 months ago #244493 by jaricianci
Thank you very much, changing the editor in the personal settings to source-code editor fixed it!

I had the pop-up editor enabled, but Limesurvey always changed it before saving.

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose