Welcome to the LimeSurvey Community Forum

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

Adding an image with EM does not work?

More
11 years 11 months ago - 11 years 11 months ago #105678 by orvil
Hi all,

currently I'm trying to add an image into a question text by using the EM.

The question text in plain html is like this:
Code:
<p>Have you seen this person recently? </p>
<p><img src="/limeSurvey/upload/surveys/123456/images/{imageList_SQ001.code}" /></p>

unfortunately the result for the image link in the question is like this:
Code:
https://www.mydomain.com/limeSurvey3/upload/surveys/123456/images/%3Cspan%20id=%27LEMtailor_Q_107_316%27%3Epicture1.jpg%3C/span%3E

- The image itself is uploaded jet, of course :)
- the expressin {imageList_SQ001.code)} standalone leads to the proper filename

Any ideas how to avoid encoding of the image-file?????

Best regards/Beste Grüße,
O. Villani
Last edit: 11 years 11 months ago by orvil.
The topic has been locked.
More
11 years 11 months ago #105689 by orvil
Hm, found the reason for this behavior:

This behavior is only, when these 2 questions are displayed at once (because of using JaveScript by LS).

Once these questions are displayed separately (question-by-question, or group-by-group mode and these questions are in different groups) it will work fine.

Anyhow, I could not find a solution if I have to display these questions at once!

Any ideas for this case?

THX

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
More
11 years 11 months ago #105700 by tpartner
I'm confused as to how you can have subquestion codes for imageList like "image1.png".

Can you attach a small sample survey?


.

Cheers,
Tony Partner

Solutions, code and workarounds presented in these forums are given without any warranty, implied or otherwise.
The topic has been locked.
More
11 years 11 months ago #105738 by orvil
Please don't be confused. The name 'imageList' is only the name of a (hidden) multiple short text question where the filenames are stored.

Best regards/Beste Grüße,
O. Villani
The topic has been locked.
More
11 years 11 months ago #105755 by DenisChenu
If the question is in the same grpup (the same page) then it was updated each time user select another answer. Then it need the <span> .

Think best is to use something like that:
Code:
<img id="img1" src="" /><div id="srcimg1" style="display:none">{imageList_SQ001.code}</div>
<script>
$(function() {
$("#img1").attr('src','/limeSurvey/upload/surveys/123456/images/'+$("#srcimg1").text());
});
$("#question{imageList_SQ001.qid} input.radio").click(function(){
$("#img1").attr('src','/limeSurvey/upload/surveys/123456/images/'+$("#srcimg1").text());
});
</script>
Maybe some fix to do.

Denis

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.
Moderators: tpartnerholch

Lime-years ahead

Online-surveys for every purse and purpose