Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

Save slider response as embedded data and NaN

cm201623
cm201623 Community Member Qubie ✭

Hi, I want to save a slider's response as embedded data and use it as the start position in next block's slider question.

Here is my code:

Qualtrics.SurveyEngine.addOnReady(function()
{
	var qobj = this;
	var qid = this.questionId;
	jQuery( "#"+qid ).on('change', function(){
		var response = parseInt(jQuery("#"+qid+"\\~1\\~true-result").val());
		Qualtrics.SurveyEngine.setEmbeddedData("ResponseTime", response);
	});				 
});

But the embedded data ResponseTime is NaN. Can someone tell me what is the problem? I think the error is from

var response = parseInt(jQuery("#"+qid+"\\~1\\~true-result").val());

but how can I access the response of this slider question? many thanks!!

i also tried the following two, but none of them work:

var response = parseInt("${q://QID23/ChoiceNumericEntryValue/1}");

var response = this.getChoiceValue(1);

another question is how I can use javascript to set slider's start position?

Answers

  • ahmedA
    ahmedA IndiaCommunity Member, XMPN Member Wizard ✭✭✭✭✭

    console.log(this.getChoices()) to see the actual choice id of your slider. Its possible you made some changes and now your slider id is probably 4 or something.