Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Dynamically show pictures

Hi,

Is there a way where I  can display pictures dynamically? I have this multi-select question and I would like to display specific pictures based on the selected items from this question.
e.g.
1. Option A
2. Option B
3. Option C

If 1 and 3 are selected, then I will display only the pictures for these 2 answers on the next page.
asked May 17, 2016 by anonymous

2 Answers

+1 vote
You can do this with a bit of JavaScript.  Here's the code I used:

<img id="DynamicImage1" src="[%GraphicsPath()%]image1.png" alt="" border="0">
<img id="DynamicImage2" src="[%GraphicsPath()%]image2.png" alt="" border="0">
<img id="DynamicImage3" src="[%GraphicsPath()%]image3.png" alt="" border="0">

<script type="text/javascript">
if (![% SelectQ_1 %]) {
    document.getElementById('DynamicImage1').style.display = 'none';
}
if (![% SelectQ_2 %]) {
    document.getElementById('DynamicImage2').style.display = 'none';
}
if (![% SelectQ_3 %]) {
    document.getElementById('DynamicImage3').style.display = 'none';
}
</script>


You'll need to replace "SelectQ" with the select question's name.
answered May 17, 2016 by Zachary Platinum Sawtooth Software, Inc. (121,425 points)
0 votes
You should create pre defined list with 3 options here, where you should insert image code like.

1. <img id="DynamicImage1" src="[%GraphicsPath()%]image1.png" alt="" border="0">
2. <img id="DynamicImage1" src="[%GraphicsPath()%]image2.png" alt="" border="0">
3. <img id="DynamicImage1" src="[%GraphicsPath()%]image3.png" alt="" border="0">


Now you can use constructed list and add member based on selection. Let me know if you need more detail.
answered May 18, 2016 by Rajesh Rana Gold (23,660 points)
...