Last active
July 11, 2018 15:47
-
-
Save mattbloomfield/fac63be414cbd4ed13839b2f62740cce to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Qualtrics.SurveyEngine.addOnload(function() { | |
var regex = /(my text string)|(my other text string)/gi; | |
var fieldName = 'FieldName'; | |
// add listener to text boxes | |
jQuery('#' + this.questionId + ' textarea').on('blur', function() { | |
// Find the value typed in textbox | |
var value = jQuery(this).val(); | |
if (value.match(regex)) { | |
// if matches then set a variable to 'true' and also store value for good measure | |
Qualtrics.SurveyEngine.setEmbeddedData(fieldName + '_Value', value) | |
Qualtrics.SurveyEngine.setEmbeddedData(fieldName, 'true') | |
} | |
}); | |
}); |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment