Have HTML in an expression? Stop LS from regenerating code?

More
3 months 2 days ago - 3 months 2 days ago #183458 by rcha88AA
Hi, in the end message area of my survey I want some information shown from the responses received.
For example, if a user says they only sleep for 5 hours, I want to show a sentence about the importance sleep, and give a URL with sleep advice.

Showing text based on a responce is no problem:
{if(AB06 == "Y", "You sleep enough, good!", "Try to sleep more, 8 hours of sleep is very important for the human body.")}

But if I want to show a URL with the text, that is causing problems.
Inserting a link in the gui/wysiwyg editor gives errors when displaying, I assume because the html link uses double quotes and the limesurvey expression also uses double quotes.
{if(AB06 == "Y", "You sleep enough, good!", "Try to sleep more, 8 hours of sleep is very important for the human body - <a href="http://example.com/">http://example.com/</a>")}

If I go into the source editor, and escape the html link double quotes with a '\', or simply replace the double quotes with single quotes, it works great.
But upon going back to the editor again saving (not even making any changes), limesurvey 'fixes' the source removing my edits, and the link doesn't work anymore.

Is there anyway to fix this, so that I can have html in an expression without LimeSurvey "interfering" with the source?

Thank you very much :)
Last edit: 3 months 2 days ago by rcha88AA.

Please Log in or Create an account to join the conversation.

LimeSurvey Partners
More
3 months 2 days ago #183468 by elissa
Hi, I tried it with reversed quotation marks and it works:
{if(AB06 == 'Y', 'You sleep enough, good!', 'Try to sleep more, 8 hours of sleep is very important for the human body - <a href="http://example.com/">http://example.com/</a>')}

Cheers

Elzbieta Lesinska
LS voluntary Polish translator and supervisor
The following user(s) said Thank You: DenisChenu, tpartner, rcha88AA

Please Log in or Create an account to join the conversation.

More
3 months 2 days ago #183476 by rcha88AA
elissa that works perfectly! I didn't test/think that we could write expressions with single quotes. My mistake.

Thank you!

Please Log in or Create an account to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now
Join our Newsletter!