Custom end message based on condition

More
10 months 1 week 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=http://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?
Attachments:

Please Log in to join the conversation.

LimeSurvey Partners
More
10 months 1 week ago #191184 by holch
I think you can't use HTML code within an equation, that is the problem.

I answer at the LimeSurvey forum in my spare time, I'm not a LimeSurvey GmbH employee.
No support via private message.

Please Log in to join the conversation.

More
10 months 1 week ago - 10 months 1 week ago #191185 by blocka
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:
{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: 10 months 1 week ago by blocka.
The following user(s) said Thank You: DenisChenu

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now