I figure out:var currentQuestionID = this.getQuestionInfo().QuestionID;var questionObject = Qualtrics.SurveyEngine.getInstance(currentQuestionID); const translate = { 1: " option 1", 2: " option 2", 3: " option 3", 4: " option 4"}; this.questionclick = function(event,element){ if (element.type == 'checkbox') { var selectedChoices = questionObject.getSelectedChoices(); selectedChoices = selectedChoices.map(myChoice => { return translate[myChoice] }) Qualtrics.SurveyEngine.setEmbeddedData("selectedChoices", selectedChoices); }};Then just insert the embedded data selectedChoices as piped text.
pogi Thank you for your response!Recoding values does not work since it only allows entering number instead of text like "option 1". Could you please elaborate on how to set embedded data conditional on which option(s) are chosen using javascript? I only know limited javascript and its application on Qualtrics - can't think of how we can actually do this now.
If I'm understanding correctly, here you use comma "," as the delimiter. So you would just need to split by "," and count the length.var myString = Qualtrics.SurveyEngine.getEmbeddedData("high_string"); var wordCount =0;wordCount = myString.trim().split(',').length;Qualtrics.SurveyEngine.setEmbeddedData("word_count", wordCount);Just put this code somewhere after your high_string is set. This should work for you as long as comma will not appear in your "word". The variable wordCount captures the number of words there, and the last line sets an embedded data called word_count to store it.(P.S. "2: Good day, 3: Nice" will be counted as 2 "words" instead of 3)
chu_2024 I actually figured out a solution:you create an embedded data to flag if the participant has submitted a response to the slidercheck on load using this embedded data to determine if we want to disable the sliderQualtrics.SurveyEngine.addOnReady(function(){ var flag = parseInt("${e://Field/flag}"); if(flag==1){ jQuery("#"+this.questionId).css("pointer-events", "none"); };});Qualtrics.SurveyEngine.addOnPageSubmit(function(type){ if(type == "next") { Qualtrics.SurveyEngine.setEmbeddedData("flag", "1"); };}); Note that this way of disabling is not perfect - you can still use "Tab" key to select the slider and move it with left and right arrow keys.
@PraDeepKotian_Ugam Thanks so much! This worked perfectly! Is it possible to not have animation but jump there directly? I used "fast" but it is still not fast enough.
I think I found a solution:var objCheck1 = jQuery( "input[id='QR\\~QID1\\~1']" ); var objCheckLabel1 = jQuery( "label[for='QR\\~QID1\\~1']"); var objCheck2 = jQuery( "input[id='QR\\~QID1\\~2']" ); var objCheckLabel2 = jQuery( "label[for='QR\\~QID1\\~2']"); var listen1 = function(e) { if (typeof e.isTrigger == 'undefined') { var n = (objCheckLabel1.attr('class')).search("q-checked"); if (n > 0) { // a }; if (n == -1) { // b }; };};var listen2 = function(e) { if (typeof e.isTrigger == 'undefined') { var n = (objCheckLabel2.attr('class')).search("q-checked"); if (n > 0) { // c }; if (n == -1) { // d }; };};objCheck1.on('change',listen1);objCheck2.on('change',listen2);
Hi ahmedA , thanks so much for the heads-up! I never knew it. Do you have an alternative solution by which we can disable the slider entirely?
This https://www.qualtrics.com/community/discussion/2385/prevent-changing-the-handle-in-a-slider-question solves the problem perfectly!
Thank pogi! I tried add something likeQualtrics.SurveyEngine.addOnReady(function(){ input.prop("disabled",true);});andQualtrics.SurveyEngine.addOnReady(function(){ jQuery("#"+this.questionId).prop('disabled',true);});But they did not prevent me from moving the slider. Am I doing it wrong?
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.