Select input to show image based on selection

Simon Tayler shared this question 4 years ago
Answered

I'm trying to create an expression whereby an image will be shown once someone selects an option from a select field. Is this possible? If so, how do I go about it or what expressions would I use?

Best Answer
photo

Drag each image into a dynamic panel.

Create an "On Change" + "Set Active Panel" event, and select the first panel to be set as active.

a1bbe2253a06c7d40a86af1e0a8c8bdb

Create a condition for this event. Drag the dropdown to the first space in the expression, then an '=' and then type in one of the values from the select list. This must exactly match a value from the select list.

d76bcab7476b26fcc281d392b2faf6c3

dbdfcfd5a77e940aeda0380aecebb223


Then, repeat this until each panel has been addressed. This is how the final events and conditions should look:

8e7f465ab5daccfcb4d6d54e3f5d6d7e

Comments (4)

photo
1

Hi Simon,


To have an example imagine you want to have 3 images and the options from the dropdown are the thre images.


A good way to simulate this would be to create a dynamic panel with three panels.


then you put each image in a different panel from the dynamic panel.


Now you have to set an event on the selection widget. Choose the "on Change" event and then add a condition. In the condition builder drag the "=" sign and on one side drag the selection widget and on the other double click and write the first item in the list. Then click on ok.


Now you have to define the action for this condition. To do this choose the "Set Active Panel" action and choose the panel that contains the image related to the first item in the selection list.


When the event is created you will see "else". Click it and a new event builder will appear. Repeat the process but this time for the second element; then the third.


I hope this helps you in your prototype.


Best,


Marc

photo
1

Hi Marc


I built your solution and it worked. My question is this:


1) Lets say your select list is Alaska, California, Texas.


2) Now in the condition builder you put the text as "Alaska", so as of now it would work.


3) Tomorrow I want to change the select list to AK, CA, TX.


4) Would I have to go back into the condition builder and change "Alaska" to "AK"?


I am guessing it is case sensitive, so if you have any typos or change anything it will not work right?

photo
1

Yes you are right!


Best,


Sonia Durán

photo
1

Drag each image into a dynamic panel.

Create an "On Change" + "Set Active Panel" event, and select the first panel to be set as active.

a1bbe2253a06c7d40a86af1e0a8c8bdb

Create a condition for this event. Drag the dropdown to the first space in the expression, then an '=' and then type in one of the values from the select list. This must exactly match a value from the select list.

d76bcab7476b26fcc281d392b2faf6c3

dbdfcfd5a77e940aeda0380aecebb223


Then, repeat this until each panel has been addressed. This is how the final events and conditions should look:

8e7f465ab5daccfcb4d6d54e3f5d6d7e