Hello,
I have a question with 30 different answers. I would like to set or add embedded data based on each response but still use the same identifier.
Currently I have this so far. Theres a syntax error and Im really green with Java but I want to learn.
What I am looking to do is for each answer set the embedded data (SBAName) so I can use the email address to be piped into an action later on. This saves me creating so many actions and branches in the flow.
'''Qualtrics.SurveyEngine.addOnload(function(
{
this.questionclick = if (element.type == 'radio')
{ var SBAName = "${e://Field/SBAName}";
Qualtrics.SurveyEngine.addEmbeddedData("DavisSBA","agfor@mail.wvu.edu");
}
});
'''
Thank you in advance for your help
Page 1 / 1
this.questionClick has to be a function, as in:
```
this.questionClick = function(event, element) {
...
}
```
```
this.questionClick = function(event, element) {
...
}
```
I want to use set.embeddeddata or add.embeddeddata but it is based on an answer. What am I missing here?
Would this be better?
Qualtrics.SurveyEngine.addOnload(function()
{
this.questionclick = function(event,element)
{
consol.log(event,element);
if (element.type == 'radio')
{
var choiceNum = element.id.split('~')[2];
if (choiceNum == 1)
Qualtrics.SurveyEngine.addEmbeddedData("SBAEmail","email.address@email.com");
}
}
});
Qualtrics.SurveyEngine.addOnload(function()
{
this.questionclick = function(event,element)
{
consol.log(event,element);
if (element.type == 'radio')
{
var choiceNum = element.id.split('~')[2];
if (choiceNum == 1)
Qualtrics.SurveyEngine.addEmbeddedData("SBAEmail","email.address@email.com");
}
}
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.