Script: Complex Grid - Conditional Split Screen Text
This article will help you setup conditional text in Complex Grids when using the Split Screen feature
Background
You may be using a 'Complex Grid' and splitting the grid across X screens. By default, the question text will remain the same the entire time. If you want to conditionalize the question text, the instructions below will help you set this up.
Instructions
- Program your 'Complex Grid' making sure to set it up to display the grid accross X rows or screens.
- Access the HTML editor tied to the 'Instructions' field
- Access the Source Code Editor
- See article: Source Code Editor
- Add the following code to this field
<script type="text/javascript">cmSurvey.onPageLoad(function(){gotoSplitResponsesBatch(getCurrentSplitResponseBatch());});</script>
- Keep the following in mind:
- You will also need to wrap conditional text in an HTML tag like a span, div, etc. and add a "data-response-batch" attribute.
- The value of this attribute should an integer that represents the iteration/split/screen.
- These numbers are zero indexed so the first iteration/split/screen is "0".
- You will add the conditionalized text/code to the Source Code Editor withing the question text
Examples
- You can use completely different text for each screen/iteration.
- This would be the text/code you would add to the Source Code Editor in the question text field for the first screen/iteration:
<div data-response-batch="0">For this next exercise...</div> - This is the text/code you would add for the second screen/iteration:
<div data-response-batch="1">Just like the last page...</div> - You can continue the pattern for as many screens/iterations as is applicable to your exercise
- This would be the text/code you would add to the Source Code Editor in the question text field for the first screen/iteration:
- You can have the same text and just change one word/phrase
- You can use the same code as above but just wrap it around the word/phrase that needs changing:
For this <span data-response-batch="0">first</span><span data-response-batch="1">next</span><span data-response-batch="2">next</span><span data-response-batch="3">next</span><span data-response-batch="4">next</span> set of statements...
- You can use the same code as above but just wrap it around the word/phrase that needs changing: