Welcome to the LimeSurvey Community Forum

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

Custom end message based on condition

  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
5 years 6 months ago #191181 by blocka
I have a survey where the last question is:

Do you want to enter our contest?

If they reply Yes, I'd like on the End Message to display the link to enter the contest. I thought I could do this

{if(Q37=='A2', '<img src=/upload/surveys/341578/images/ipad.png style=float: left; height: 233px; width: 180px; /><br/><a href=https://example.com target=_blank>

Click here to be taken to another site where you can provide us with your contact information.


<p>This keeps your previous questionnaire responses anonymous.</p>', 'Thank you for completing the survey<br/>You can now close your web browser.')}

But instead, I get this output:



What am I doing wrong?
The topic has been locked.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 6 months ago #191184 by holch
Replied by holch on topic Custom end message based on condition
I think you can't use HTML code within an equation, that is the problem.

Help us to help you!
  • Provide your LS version and where it is installed (own server, uni/employer, SaaS hosting, etc.).
  • Always provide a LSS file (not LSQ or LSG).
Note: I answer at this forum in my spare time, I'm not a LimeSurvey GmbH employee.
The topic has been locked.
  • blocka
  • blocka's Avatar Topic Author
  • Offline
  • Platinum Member
  • Platinum Member
More
5 years 6 months ago - 5 years 6 months ago #191185 by blocka
Replied by blocka on topic Custom end message based on condition
Figured it out: use double quotes around the HTML, single quotes around elements, and DO NOT leave any spaces between tags -- any spaces between tags causes the parsing error.

So, my condition works when it is coded like this:
Code:
{if(Q37=="A2", "<center><p><img style='height: 233px; width: 180px;' src='/upload/surveys/341578/images/ipad.png' alt='' /></p><h2><a href='https://example.com'>Click here to be taken to another site where you can<br/> provide us with your contact information.</a></h2><p>This keeps your previous questionnaire responses anonymous.</p></center>", "Thank you for completing the Survey<br/>You can now close your web browser.")}
Last edit: 5 years 6 months ago by blocka.
The following user(s) said Thank You: DenisChenu
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose