Trying to set embedded data from radio or dropdown response
Hello,
I am trying to get the numerical value of a response (1 for first choice, 2 for second and so on) so I can use it to set a specific email.
Here is my code so far:
Qualtrics.SurveyEngine.addOnload(function()
{
document.getElementbyID("QID6").style.display="none";
this.questionclick = function(event,element)
{
console.log(event, element);
if (element.tagName == 'SELECT')
{
var choiceNum = element.value
if (choiceNum == 1) {
Qualtrics.SurveyEngine.setEmbeddedData("SBAEmail","email@email.com");
} else if (choiceNum == 2) {
Qualtrics.SurveyEngine.setEmbeddedData("SBAEmail","email2@email.com");
} else if (choiceNum == 3) {
Qualtrics.SurveyEngine.setEmbeddedData("SBAEmail","email3@email.com");
}
}
}
});
This only works for the first reponse. What am I missing here?
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.

We have tried your code, entering the question query,
!
with a matching action, but are unable to make the action work. I tried just using QID40, or just 40. I know this must be something simple I am missing, but i spent all night trying to make it work.
Thank you, we owe you one for your assistance.