This was very helpful.I used your final suggestions (i.e., the "same question" approach).It took me a bit to figure out what ".eq(4)" was for and that I needed to start counting from 0 and not 1.But, it's working now, so all is good.Thanks much.,
I'm jumping onto this conversation late, but it's relevant to my current problem.I ask date of birth in a field of a multi-field text entry form and want to computer the person's age.I got the JS code to work correctly when the date of birth is a stand-alone field.Qualtrics.SurveyEngine.addOnPageSubmit(function() { var age = moment().diff(moment(jQuery("#"+this.questionId+" .InputText").val()), 'years'); Qualtrics.SurveyEngine.setEmbeddedData('UserAge', age);});But, when I tried to adapt this code to a multi-field form.Qualtrics.SurveyEngine.addOnPageSubmit(function() { var age = moment().diff(moment(jQuery("${q://QID4/ChoiceTextEntryValue/5}").val()), 'years'); Qualtrics.SurveyEngine.setEmbeddedData('UserAge', age);});I get UserAge = 0 regardless of the date of birth.I'm assuming that the syntax I used to specify the field is incorrect. Can you give me any suggestion of what I need to change?
Thanks. I'll take a look.
It's their birth date.
Thanks for the link. I'll check it out.
I am familiar with Java, but I haven't done such a task before. How do I get into the JS editor?
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.