Welcome to the LimeSurvey Community Forum

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

insert image with if condition

  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 10 months ago - 5 years 10 months ago #177864 by KompetenzZ
insert image with if condition was created 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: 5 years 10 months ago by KompetenzZ.
The topic has been locked.
  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • LimeSurvey Community Team & Official Partner
  • LimeSurvey Community Team & Official Partner
More
5 years 10 months ago #177866 by DenisChenu
Replied by DenisChenu on topic insert image with if condition
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.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 10 months ago #177875 by KompetenzZ
Replied by KompetenzZ on topic insert image with if condition
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.
  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Community Team
  • LimeSurvey Community Team
More
5 years 10 months ago #177878 by holch
Replied by holch on topic insert image with if condition

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 ".

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

The following user(s) said Thank You: DenisChenu, KompetenzZ
The topic has been locked.
  • KompetenzZ
  • KompetenzZ's Avatar Topic Author
  • Offline
  • Premium Member
  • Premium Member
More
5 years 10 months ago #178065 by KompetenzZ
Replied by KompetenzZ on topic insert image with if condition
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