Welcome to the LimeSurvey Community Forum

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

Using HTML in if statement in end message and admin notification email

More
3 years 4 weeks ago #227236 by mvc
Please help us help you and fill where relevant:
Your LimeSurvey version: 5.2.14+220214
Own server or LimeSurvey hosting: own server (shared hosting)
Survey theme/template:
==================
I would like to display the questions and the respective responses to certain questions in the end message and the admin notification email depending on whether they've been presented to the user. Is there a way to do that and also use include HTML? I was trying something like

{if(Q00001 != 'YES' OR Q00002 != 'YES, "<p>Some text</p>")}

but that produces an error.
 

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 weeks ago #227246 by Joffm
Hi,
1. what type of question are Q00001 and Q00002?
2. If this is really the equation you entered
{if(Q00001 != 'YES' OR Q00002 != 'YES, "<p>Some text</p>")}
you see that the quote after the second 'YES' is missing.

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
3 years 4 weeks ago #227247 by mvc
Thank you for your reply!

1. Both questions are of type "List (radio)".
2. The equation I put into my post wasn't the actual equation; I was trying to give a simplified example and unfortunately, I forgot the second quote. My apologies!

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 weeks ago #227249 by Joffm
Hi,
1. If you use the inline HTML editor, change to source code editor.
This editor takes into account the <p> tag.

2. With inline editor I do not see an issue here
<p>{if(Q1_SQ001 != 'YES' OR Q1_SQ002 != 'YES', "Some text")}</p>

Joffm

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 weeks ago #227252 by tpartner
...assuming "YES" is an answer code, not the answer label.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

More
3 years 4 weeks ago - 3 years 4 weeks ago #227253 by mvc
Unfortunately, I can't seem to get it to work. This is the feedback I get from the survey logic file for the text in the end message.

 

It works just fine with simple text, but as soon as I include HTML it breaks. Single or double quotation marks don't make a difference.
Last edit: 3 years 4 weeks ago by mvc.

Please Log in to join the conversation.

More
3 years 4 weeks ago #227254 by mvc

...assuming "YES" is an answer code, not the answer label.
Yeah, I used the answer code in the if statement.

Please Log in to join the conversation.

  • tpartner
  • tpartner's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 weeks ago #227255 by tpartner
Place the HTML in an equation question and reference that in your IF statement.

Code:
{if(Q00001 != 'NO' OR Q00002 != 'NO', equation1.question)}

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 weeks ago #227256 by Joffm
Here the comparison HTML editor vs. source code editor

1. HTML
 

after saving
 

and the logic file
 

2. source code editor
 

logic file
 

result
 

 

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

More
3 years 4 weeks ago #227257 by mvc
@Joffm: This is probably a stupid question but how do I switch to the source code editor? When you mentioned it earlier I thought you meant clicking on the source code icon in the toolbar (the second one from the left in your screenshot) and editing the HTML in the popup (which is what I always do when I need to edit the HTML). But apparently that's the wrong way to got about it?

Please Log in to join the conversation.

  • Joffm
  • Joffm's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
3 years 4 weeks ago #227261 by Joffm
Either in
"Configuration / Global / General"
or in 
"My account / Personal settings"

Volunteers are not paid.
Not because they are worthless, but because they are priceless

Please Log in to join the conversation.

Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose