Home > Uncategorized > How To Dynamically Display Answer Images based on an answer of a question

How To Dynamically Display Answer Images based on an answer of a question

 

Overview

Part of the SurveyToGo features is the ability to attach and display images as answers. One way is to assign images manually to each answer, as you can learn in this link:http://support.dooblo.net/entries/22814656-How-to-add-images-to-Answers-and-Topics

In this How To, you’ll learn a dynamic way to assign and display images as answers based on an answer of a question.

 

 

Step 1: Add the wanted images to the survey

All images used, need to be uploaded to the survey. To upload images files to the survey, go to the survey’s advanced tab, click on the “Edit survey attachments” link and add your files through the “New” button:

 

Step 2: Create Attachment Source

 For example let’s assume the question I would like to base my answers images has the following 3 answers:


Then these are the steps you should follow:

  1. Go to the survey Advanced tab and open the “Edit attachment source” link:

 

  1. Click on the “+” button to add the attachment source, and name it as you will. To add images to the attachment source, you need to use this code:

    list.AddFromAttachment(“ImageName”);

    “ImageName” should be replaced with a name of an image you uploaded to the survey.

    For each answer you have in the question you should have a part in your script which adds the images for this answers.

    In each part, each image you’ll add to the attachment source will be displayed for each answer, according to the order you added in. For example, in the screen shot below, you see the “Country” attachment source, where we have 3 “if” statements and in each of them three images are added. This means that in the question I’ll use this attachment source, the coca-cola image will be displayed in answer index 1, the sprit4e image will be displayed in answer index 2, and the Fanta image will be displayed in answer index 3.


    When you finish with the attachment source, click “OK”.

 

Step 3: Assign the attachment source to the question

Go to the question’s Advanced tab, and choose the relevant attachment source to be defined for the “AnswerAttachmentSource” property:


 

 

The attached sample survey will show you an example of the method described above.

In order to test the sample, you’ll need to perform the following:

 

 

That’s it!

Visit us at: http://www.dooblo.net

Categories: Uncategorized
  1. No comments yet.
  1. No trackbacks yet.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: