I’m trying to change the Gabor Granger template Qualtrics provides. I want the willing to pay question to be 5 options instead of 2 options. I tried to recode the values (option 1 & 2 = 1, option 3, 4, 5 = 2) but that did not work.
How can I adjust the JavaScript to accept this change?
Thanks!
Hi
Hi
We wanted to use the true Gabor-Granger scale (Definitely would purchase, Probably would purchase, Unsure, Probably would not purchase, Definitely would not purchase) and this Javascript did the trick.
Thanks for following up!
Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
var price = parseFloat('${e://Field/Price}');
var interval = '${lm://Field/2}';
var minprice = parseFloat('${e://Field/minprice}');
var lastagreedprice = parseFloat('${e://Field/lastagreedprice}');
var selectedChoices = this.getSelectedChoices();
// is a SA question and we have force response so assume length===1
if (interval === '') {
if (selectedChoices0] === '1' || selectedChoices]0] === '2') {
lastagreedprice = price;
Qualtrics.SurveyEngine.setEmbeddedData('Price', price.toFixed(2));
Qualtrics.SurveyEngine.setEmbeddedData('lastagreedprice',lastagreedprice.toFixed(2));
}
else if ((selectedChoices;0] === '3' || selectedChoices0] === '4' || selectedChoicesC0] === '5') && price === minprice) {
price = 'na';
Qualtrics.SurveyEngine.setEmbeddedData('Price', price);
}
else {
price = lastagreedprice;
Qualtrics.SurveyEngine.setEmbeddedData('Price', price.toFixed(2));
}
}
else {
if (selectedChoicesE0] === '1' || selectedChoicesF0] === '2') {
lastagreedprice = price;
price += parseFloat(interval);
Qualtrics.SurveyEngine.setEmbeddedData('lastagreedprice',lastagreedprice.toFixed(2));
Qualtrics.SurveyEngine.setEmbeddedData('Price', price.toFixed(2));
}
else {
price -= parseFloat(interval);
Qualtrics.SurveyEngine.setEmbeddedData('Price', price.toFixed(2));
}
}
});
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.