Overview
In this guide we will describe the steps to create Dynamic pages when you are running CAWI surveys.
This can be mainly used to Display/Hide Questions/Answers/Topics based on other chosen Answers/Topics in Questions
Steps
- Navigate to the 'Survey Properties'
- Under 'Scripting' enable the option 'Use CAWI Client Side Scripts'
- Set the survey to show X Questions per page (According to your needs)
- Under each question a new tab will be shown called 'CAWI Client Side Scripts'
- Start scripting - add the logic of the dynamic pages in this tab, all function will start with stg for example: stgSetAnswerVisible() - will show/hide an answer etc.
Sample: In the attached sample we have 2 Chapters
Chapter1 - will show how to implement Show/Hide Questions/Answers
Q1 - Country
Q2 - City - will show the answers according to the chosen Country in Q1
Q3 - Favorite Country - Question will be shown only if USA/UK are chosen
the code can be found in Q1 under the 'CAWI Client Side Scripts' tab where we first hide all the Answers in Q2 and we are hiding Q3 and then according to the logic we display the answers and question.
Chapter2 - will show how to implement Show/Hide Questions/Answers
Q4 - Choose Brands
Q5 - Favorite Brand - will filter the answers according to the chosen answers in Q4
Q6 - Rate Brands - will filter the Topics according to the chosen answers in Q4
the code can be found in Q4 under the 'CAWI Client Side Scripts' tab where we use the functions to Filter Answers/Topics.
List of Available Functions
Function Name | Description |
stgAnswer(inQIdx) | Returns the answer (Text or Index) of a specific question |
stgAnswerChoice(inQIdx, inTopicIdx) | Returns the value (Text or Index) of the chosen Topic |
stgClearAnswer(inQIdx) | Will clear the answer for a specific question |
stgContains(inQIdx, inAnswer) | Returns true if the inValue was selected in the inQuesIdx question as one of the answers |
stgContainsChoice(inQIdx, inTopicIdx,inAnswer) | Returns true if the value was selected in a specific topic and false otherwise |
stgFilterAnswersByAnswers(inTargetQues, inShow, inSourceQues) | Filter the answers of one question according to the chosen answers of another question |
stgFilterTopicsByAnswers(inTargetQues, inShow, inSourceQues) | Filter the topics of one question according to the chosen answers of another question |
stgFilterTopicsByTopics(inTargetQues, inShow, inSourceQues,inValues) | Filter the topics of one question according to the chosen topics of another question |
stgGetQuestionElement(inQIdx) | |
stgGetQuestionType(inQIdx) | Get the Question type |
stgIsArraysHaveCommonElement(inFirstArray,inSecondArray) | |
stgSetAnswer(inQIdx,inValue) | Will set an answer with a value |
stgSetAnswerChoice(inQIdx, inTopicIdx, inValue) | Will set a topic with a value |
stgSetAnswerVisible(inQIdx, inShow, inAnswerIdx) | Will Show/Hide an Answer |
stgSetTopicVisible(inQIdx, inShow, inTopicIdx) | Will Show/Hide a Topic |
stgShowQuestion(inQIdx, inShow) | Will Show/Hide a Question |
Comments
Please sign in to leave a comment.