How can I add an image from my Graphics Library via Javascript? | XM Community
Skip to main content

Hi all, I'm working on survey where based on a respondent's response to a previous question, they should receive a particular image as opposed to another. Now normally I could make branches and upload the images manually, but I have hundreds of branches and so this is quite impractical. I've uploaded the images to my graphics library with a common beginning and the extension that corresponds to the previous question the respondent answered, so my question is basically how I can link the images from my graphics library such that only one image is displayed.
For example, suppose there are three options respondents could have earlier picked from: 1, 2, or 3. I'd like to do something like:
var option = "${q://QID4/ChoiceGroup/SelectedAnswers/2}";
if (option == "1") {

 }
if (option == "2") {

 }
and so on (I can easily write a script to print this text automatically for each option).
The big problem is that the images URL is not linked to the name I gave the file. So I can't systematically source the images. Am I missing something? Is there an easier way to do this? Thanks for the help in advance.
EDIT: It occurs to me that another possible solution would be to download all the URLs and their matching image descriptions, but it appears I can't do that systematically, I have to click each one once at a time...

Leave a Reply