Welcome to the LimeSurvey Community Forum

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

insert image with if condition

More
6 years 9 months ago - 6 years 9 months ago #177864 by KompetenzZ
Hi,


I think maybe I've read something about this topic before, but I cannot find it in the forum again. I tried to insert images with a if condition:
Code:
{if((Q1=="1"), "<img src="abc.png" />", "<img src="xyz.png")}

I found that "Filter HTML for XSS" should be disabled www.limesurvey.org/manual/Expression_Manager#XSS_security

So, I disabled it, but I guess insert images with if conditions does not work. Is there another way to insert images based on previous answers?

Cheers kompetenzz
Last edit: 6 years 9 months ago by KompetenzZ.
The topic has been locked.
More
6 years 9 months ago #177866 by DenisChenu
double quote inside double quote : it broke.
And last image not closed
It must be OK with XSS too
Code:
{if((Q1=="1"), '<img src="abc.png" />', '<img src="xyz.png">')}

Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member. - Professional support - Plugins, theme and development .
I don't answer to private message.
The topic has been locked.
More
6 years 9 months ago #177875 by KompetenzZ
That is my aha-experience for today. Sorry I just forgot to close the image in the last example code.
This means that double quotes are only compatible with single quotes inside, vice versa. Thank you, I didn't know that.

Cheers kompetenzz
The topic has been locked.
More
6 years 9 months ago #177878 by holch

This means that double quotes are only compatible with single quotes inside, vice versa.

Of course. The program is stupid. When you open a " the next " that comes closes things. Limesurvey (or any other program) won't know that this is actually a new opening ".

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 following user(s) said Thank You: DenisChenu, KompetenzZ
The topic has been locked.
More
6 years 9 months ago #178065 by KompetenzZ
Just for reference, now I found the also the old thread on this topic for further reading:
:)

www.limesurvey.org/forum/installation-a-...for-questions#168436

Cheers kompetenzz
The topic has been locked.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose