Hello,
Can someone please help.
I have few hundreds of words to be avoided being entered in the free text field while user answering the survey.
Only option I see is to add one condition for each word.
Can someone help with the java script code if its possible.
Hi,
Here is the script you are looking for. Try modifying it based on your requirement.
var substrings = ="Monday", "Tuesday", "Wednesday"];
var str;
str = "Hey, today is Monday!";
if (new RegExp(substrings.join("|")).test(str)) {
console.log("Text have a word from array!");
} else {
console.log("Text don't have any word from array!");
}
All the very best for your project!
Thanks cbhavsar .
Do you have any idea how can I use this code in Qualtrics for validation of the entered text?
Using Jquery or Javascript you can fetch the text and store it in str variable of my script earlier. I suggest you should execute this script before page unload.
In case you are looking where you can place JS, then click on the question - the last option in the left pane would be Javascript and there you should add script under Qualtrics.SurveyEngine.addOnUnload
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.