Forced Response on Coded Word Search | XM Community
Skip to main content
Solved

Forced Response on Coded Word Search

  • May 11, 2023
  • 5 replies
  • 62 views

Forum|alt.badge.img+3

Hello all!

I am back again with another question relating to my word search.

For some reason, it seems that less than HALF of my participants were able to finish the survey without completing the word search task. There is a timer on the page, and I have noticed that you can choose to click the next arrow without actually doing the task.

How do I apply a forced response to the coded task? 

What sort of validation do I apply so that the page can not be skipped?

Best answer by Tom_1842

Hello again! I’d recommend hiding the Next button until the desired ‘words found’ score is reached. Code is updated below so that the Next button only displays when all 19 words are found:

this.hideNextButton();

var countrygrid = [
['A', 'I', 'V', 'T', 'A', 'L', 'N', 'I', 'E', 'T', 'S', 'G', 'A', 'T', 'H', 'C', 'E', 'I', 'L'],
['G', 'A', 'C', 'H', 'I', 'E', 'V', 'E', 'A', 'N', 'D', 'S', 'N', 'T', 'V', 'A', 'A', 'P', 'W'],
['A', 'C', 'C', 'O', 'M', 'P', 'L', 'I', 'S', 'H', 'S', 'R', 'O', 'R', 'I', 'I', 'O', 'C', 'I'],
['S', 'T', 'E', 'J', 'V', 'U', 'E', 'T', 'Y', 'C', 'N', 'L', 'E', 'I', 'A', 'R', 'I', 'D', 'N'],
['O', 'U', 'P', 'M', 'J', 'J', 'L', 'C', 'O', 'B', 'A', 'A', 'T', 'U', 'T', 'P', 'N', 'E', 'N'],
['B', 'E', 'C', 'I', 'V', 'E', 'S', 'C', 'N', 'N', 'T', 'N', 'U', 'M', 'E', 'A', 'S', 'V', 'E'],
['M', 'A', 'E', 'C', 'K', 'A', 'L', 'L', 'E', 'A', 'U', 'W', 'G', 'P', 'L', 'E', 'X', 'C', 'R'],
['E', 'G', 'J', 'N', 'E', 'A', 'T', 'V', 'O', 'A', 'R', 'A', 'B', 'H', 'T', 'B', 'R', 'Z', 'W'],
['X', 'E', 'J', 'W', 'N', 'S', 'S', 'L', 'S', 'V', 'L', 'F', 'S', 'C', 'O', 'R', 'E', 'G', 'R'],
['U', 'Y', 'P', 'D', 'I', 'V', 'S', 'S', 'A', 'S', 'A', 'Z', 'L', 'L', 'R', 'L', 'L', 'S', 'O'],
['L', 'R', 'R', 'M', 'A', 'C', 'T', 'P', 'S', 'M', 'T', 'K', 'G', 'T', 'N', 'V', 'P', 'N', 'N'],
['I', 'A', 'C', 'H', 'A', 'M', 'P', 'I', 'O', 'N', 'Y', 'A', 'I', 'J', 'N', 'S', 'K', 'D', 'J'],
['V', 'G', 'N', 'I', 'N', 'O', 'O', 'K', 'W', 'R', 'R', 'H', 'U', 'A', 'E', 'D', 'R', 'N', 'D'],
['I', 'N', 'I', 'I', 'T', 'R', 'E', 'P', 'R', 'E', 'V', 'A', 'I', 'L', 'J', 'N', 'A', 'A', 'J'],
['C', 'U', 'A', 'V', 'K', 'A', 'A', 'T', 'A', 'G', 'P', 'C', 'A', 'O', 'H', 'I', 'M', 'L', 'F'],
['T', 'H', 'Z', 'U', 'V', 'J', 'O', 'G', 'O', 'V', 'E', 'R', 'C', 'O', 'M', 'E', 'N', 'G', 'O'],
['O', 'E', 'D', 'E', 'C', 'S', 'B', 'R', 'N', 'N', 'U', 'V', 'J', 'Z', 'T', 'E', 'E', 'N', 'R'],
['R', 'S', 'U', 'R', 'A', 'L', 'E', 'B', 'C', 'T', 'I', 'I', 'G', 'I', 'C', 'B', 'E', 'S', 'T'],
['Y', 'N', 'A', 'I', 'T', 'I', 'F', 'A', 'T', 'T', 'A', 'I', 'N', 'Y', 'W', 'I', 'M', 'E', 'I']];

var countrynames = ['ACCOMPLISH', 'ACHIEVE', 'ATTAIN', 'BEST', 'CHAMPION', 'OVERCOME', 'PREVAIL', 'SCORE', 'SUCCESS',
'TRIUMPH', 'CAN', 'VICTORY', 'WINNER', 'ON', 'HIM', 'NOOK', 'IT', 'TAG',
'FOR'];

function getRandom(arr, n) {
var result = new Array(n),
len = arr.length,
taken = new Array(len);
if (n > len)
throw new RangeError("getRandom: more elements taken than available");
while (n--) {
var x = Math.floor(Math.random() * len);
result[n] = arr[x in taken ? taken[x] : x];
taken[x] = --len in taken ? taken[len] : len;
}
return result;
}

var wordnames = getRandom(countrynames, 19)

function storeScoreAndTimingInQualtrics() {
var score = this.getScore();
var timing = this.getTiming();
var timing_str = timing.join(",") // Convert the timings separated by commas to a string
Qualtrics.SurveyEngine.setEmbeddedData("wordsFound", score);
Qualtrics.SurveyEngine.setEmbeddedData("timingWordsFound", timing_str);
if(score == 19) {
jQuery("#NextButton").show();
}
}

ws = new WordSearch({
"grid": countrygrid, // Your grid to search
"words": wordnames, // The list of words to find
"parentId": "mysearchtask",
"onFindWord": storeScoreAndTimingInQualtrics // When a word is found...
});

 

5 replies

MikeW
Level 5 ●●●●●
Forum|alt.badge.img+14
  • Level 5 ●●●●●
  • May 11, 2023

I’m not sure of the details of your specific question type… but most questions have the option to force a response

 


Tom_1842
Level 8 ●●●●●●●●
Forum|alt.badge.img+28
  • Level 8 ●●●●●●●●
  • Answer
  • May 11, 2023

Hello again! I’d recommend hiding the Next button until the desired ‘words found’ score is reached. Code is updated below so that the Next button only displays when all 19 words are found:

this.hideNextButton();

var countrygrid = [
['A', 'I', 'V', 'T', 'A', 'L', 'N', 'I', 'E', 'T', 'S', 'G', 'A', 'T', 'H', 'C', 'E', 'I', 'L'],
['G', 'A', 'C', 'H', 'I', 'E', 'V', 'E', 'A', 'N', 'D', 'S', 'N', 'T', 'V', 'A', 'A', 'P', 'W'],
['A', 'C', 'C', 'O', 'M', 'P', 'L', 'I', 'S', 'H', 'S', 'R', 'O', 'R', 'I', 'I', 'O', 'C', 'I'],
['S', 'T', 'E', 'J', 'V', 'U', 'E', 'T', 'Y', 'C', 'N', 'L', 'E', 'I', 'A', 'R', 'I', 'D', 'N'],
['O', 'U', 'P', 'M', 'J', 'J', 'L', 'C', 'O', 'B', 'A', 'A', 'T', 'U', 'T', 'P', 'N', 'E', 'N'],
['B', 'E', 'C', 'I', 'V', 'E', 'S', 'C', 'N', 'N', 'T', 'N', 'U', 'M', 'E', 'A', 'S', 'V', 'E'],
['M', 'A', 'E', 'C', 'K', 'A', 'L', 'L', 'E', 'A', 'U', 'W', 'G', 'P', 'L', 'E', 'X', 'C', 'R'],
['E', 'G', 'J', 'N', 'E', 'A', 'T', 'V', 'O', 'A', 'R', 'A', 'B', 'H', 'T', 'B', 'R', 'Z', 'W'],
['X', 'E', 'J', 'W', 'N', 'S', 'S', 'L', 'S', 'V', 'L', 'F', 'S', 'C', 'O', 'R', 'E', 'G', 'R'],
['U', 'Y', 'P', 'D', 'I', 'V', 'S', 'S', 'A', 'S', 'A', 'Z', 'L', 'L', 'R', 'L', 'L', 'S', 'O'],
['L', 'R', 'R', 'M', 'A', 'C', 'T', 'P', 'S', 'M', 'T', 'K', 'G', 'T', 'N', 'V', 'P', 'N', 'N'],
['I', 'A', 'C', 'H', 'A', 'M', 'P', 'I', 'O', 'N', 'Y', 'A', 'I', 'J', 'N', 'S', 'K', 'D', 'J'],
['V', 'G', 'N', 'I', 'N', 'O', 'O', 'K', 'W', 'R', 'R', 'H', 'U', 'A', 'E', 'D', 'R', 'N', 'D'],
['I', 'N', 'I', 'I', 'T', 'R', 'E', 'P', 'R', 'E', 'V', 'A', 'I', 'L', 'J', 'N', 'A', 'A', 'J'],
['C', 'U', 'A', 'V', 'K', 'A', 'A', 'T', 'A', 'G', 'P', 'C', 'A', 'O', 'H', 'I', 'M', 'L', 'F'],
['T', 'H', 'Z', 'U', 'V', 'J', 'O', 'G', 'O', 'V', 'E', 'R', 'C', 'O', 'M', 'E', 'N', 'G', 'O'],
['O', 'E', 'D', 'E', 'C', 'S', 'B', 'R', 'N', 'N', 'U', 'V', 'J', 'Z', 'T', 'E', 'E', 'N', 'R'],
['R', 'S', 'U', 'R', 'A', 'L', 'E', 'B', 'C', 'T', 'I', 'I', 'G', 'I', 'C', 'B', 'E', 'S', 'T'],
['Y', 'N', 'A', 'I', 'T', 'I', 'F', 'A', 'T', 'T', 'A', 'I', 'N', 'Y', 'W', 'I', 'M', 'E', 'I']];

var countrynames = ['ACCOMPLISH', 'ACHIEVE', 'ATTAIN', 'BEST', 'CHAMPION', 'OVERCOME', 'PREVAIL', 'SCORE', 'SUCCESS',
'TRIUMPH', 'CAN', 'VICTORY', 'WINNER', 'ON', 'HIM', 'NOOK', 'IT', 'TAG',
'FOR'];

function getRandom(arr, n) {
var result = new Array(n),
len = arr.length,
taken = new Array(len);
if (n > len)
throw new RangeError("getRandom: more elements taken than available");
while (n--) {
var x = Math.floor(Math.random() * len);
result[n] = arr[x in taken ? taken[x] : x];
taken[x] = --len in taken ? taken[len] : len;
}
return result;
}

var wordnames = getRandom(countrynames, 19)

function storeScoreAndTimingInQualtrics() {
var score = this.getScore();
var timing = this.getTiming();
var timing_str = timing.join(",") // Convert the timings separated by commas to a string
Qualtrics.SurveyEngine.setEmbeddedData("wordsFound", score);
Qualtrics.SurveyEngine.setEmbeddedData("timingWordsFound", timing_str);
if(score == 19) {
jQuery("#NextButton").show();
}
}

ws = new WordSearch({
"grid": countrygrid, // Your grid to search
"words": wordnames, // The list of words to find
"parentId": "mysearchtask",
"onFindWord": storeScoreAndTimingInQualtrics // When a word is found...
});

 


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • May 11, 2023

Hello again! I’d recommend hiding the Next button until the desired ‘words found’ score is reached. Code is updated below so that the Next button only displays when all 19 words are found:

this.hideNextButton();

var countrygrid = [
['A', 'I', 'V', 'T', 'A', 'L', 'N', 'I', 'E', 'T', 'S', 'G', 'A', 'T', 'H', 'C', 'E', 'I', 'L'],
['G', 'A', 'C', 'H', 'I', 'E', 'V', 'E', 'A', 'N', 'D', 'S', 'N', 'T', 'V', 'A', 'A', 'P', 'W'],
['A', 'C', 'C', 'O', 'M', 'P', 'L', 'I', 'S', 'H', 'S', 'R', 'O', 'R', 'I', 'I', 'O', 'C', 'I'],
['S', 'T', 'E', 'J', 'V', 'U', 'E', 'T', 'Y', 'C', 'N', 'L', 'E', 'I', 'A', 'R', 'I', 'D', 'N'],
['O', 'U', 'P', 'M', 'J', 'J', 'L', 'C', 'O', 'B', 'A', 'A', 'T', 'U', 'T', 'P', 'N', 'E', 'N'],
['B', 'E', 'C', 'I', 'V', 'E', 'S', 'C', 'N', 'N', 'T', 'N', 'U', 'M', 'E', 'A', 'S', 'V', 'E'],
['M', 'A', 'E', 'C', 'K', 'A', 'L', 'L', 'E', 'A', 'U', 'W', 'G', 'P', 'L', 'E', 'X', 'C', 'R'],
['E', 'G', 'J', 'N', 'E', 'A', 'T', 'V', 'O', 'A', 'R', 'A', 'B', 'H', 'T', 'B', 'R', 'Z', 'W'],
['X', 'E', 'J', 'W', 'N', 'S', 'S', 'L', 'S', 'V', 'L', 'F', 'S', 'C', 'O', 'R', 'E', 'G', 'R'],
['U', 'Y', 'P', 'D', 'I', 'V', 'S', 'S', 'A', 'S', 'A', 'Z', 'L', 'L', 'R', 'L', 'L', 'S', 'O'],
['L', 'R', 'R', 'M', 'A', 'C', 'T', 'P', 'S', 'M', 'T', 'K', 'G', 'T', 'N', 'V', 'P', 'N', 'N'],
['I', 'A', 'C', 'H', 'A', 'M', 'P', 'I', 'O', 'N', 'Y', 'A', 'I', 'J', 'N', 'S', 'K', 'D', 'J'],
['V', 'G', 'N', 'I', 'N', 'O', 'O', 'K', 'W', 'R', 'R', 'H', 'U', 'A', 'E', 'D', 'R', 'N', 'D'],
['I', 'N', 'I', 'I', 'T', 'R', 'E', 'P', 'R', 'E', 'V', 'A', 'I', 'L', 'J', 'N', 'A', 'A', 'J'],
['C', 'U', 'A', 'V', 'K', 'A', 'A', 'T', 'A', 'G', 'P', 'C', 'A', 'O', 'H', 'I', 'M', 'L', 'F'],
['T', 'H', 'Z', 'U', 'V', 'J', 'O', 'G', 'O', 'V', 'E', 'R', 'C', 'O', 'M', 'E', 'N', 'G', 'O'],
['O', 'E', 'D', 'E', 'C', 'S', 'B', 'R', 'N', 'N', 'U', 'V', 'J', 'Z', 'T', 'E', 'E', 'N', 'R'],
['R', 'S', 'U', 'R', 'A', 'L', 'E', 'B', 'C', 'T', 'I', 'I', 'G', 'I', 'C', 'B', 'E', 'S', 'T'],
['Y', 'N', 'A', 'I', 'T', 'I', 'F', 'A', 'T', 'T', 'A', 'I', 'N', 'Y', 'W', 'I', 'M', 'E', 'I']];

var countrynames = ['ACCOMPLISH', 'ACHIEVE', 'ATTAIN', 'BEST', 'CHAMPION', 'OVERCOME', 'PREVAIL', 'SCORE', 'SUCCESS',
'TRIUMPH', 'CAN', 'VICTORY', 'WINNER', 'ON', 'HIM', 'NOOK', 'IT', 'TAG',
'FOR'];

function getRandom(arr, n) {
var result = new Array(n),
len = arr.length,
taken = new Array(len);
if (n > len)
throw new RangeError("getRandom: more elements taken than available");
while (n--) {
var x = Math.floor(Math.random() * len);
result[n] = arr[x in taken ? taken[x] : x];
taken[x] = --len in taken ? taken[len] : len;
}
return result;
}

var wordnames = getRandom(countrynames, 19)

function storeScoreAndTimingInQualtrics() {
var score = this.getScore();
var timing = this.getTiming();
var timing_str = timing.join(",") // Convert the timings separated by commas to a string
Qualtrics.SurveyEngine.setEmbeddedData("wordsFound", score);
Qualtrics.SurveyEngine.setEmbeddedData("timingWordsFound", timing_str);
if(score == 19) {
jQuery("#NextButton").show();
}
}

ws = new WordSearch({
"grid": countrygrid, // Your grid to search
"words": wordnames, // The list of words to find
"parentId": "mysearchtask",
"onFindWord": storeScoreAndTimingInQualtrics // When a word is found...
});

The survey doesn’t actually require participants to find all of the words and only what they are able to in the time provided. Therefore, by using the code to hide the next button until all words are found, will it cause issues?

 


Tom_1842
Level 8 ●●●●●●●●
Forum|alt.badge.img+28
  • Level 8 ●●●●●●●●
  • May 12, 2023

I don’t think it will cause any issues. Since you have a Timing question that auto advances the page, the respondent will either find all 19 words and then be able to advance the page themselves, or they will be advanced by the Timing question. 


Forum|alt.badge.img+3
  • Author
  • Level 2 ●●
  • May 12, 2023

Hello! Thank you for your help and responses, they are greatly appreciated.

You’ve saved the day once again!