Getting a null value for last choice row in slider question | XM Community
Question

Getting a null value for last choice row in slider question

  • 12 June 2019
  • 1 reply
  • 8 views

Hi,

I'm trying to simply grab the choice values from a slider question in javascript. I have 8 rows/choices in the question and I'm able to grab the first 7 rows, but for some reason, I'm unable to get the last row.

var food_Cereal = this.getChoiceValue(1);
var food_Pulses = this.getChoiceValue(2);
var food_Veg = this.getChoiceValue(3);
var food_Fruit = this.getChoiceValue(4);
var food_Meat = this.getChoiceValue(5);
var food_Milk = this.getChoiceValue(6);
var food_Sugar = this.getChoiceValue(7);
var food_Oil = this.getChoiceValue(8);

alert("TEST: Cereal and Tubers: " + food_Cereal);
alert("TEST: Pulses: " + food_Pulses);
alert("TEST: Vegetables: " + food_Veg);
alert("TEST: Fruit: " + food_Fruit);
alert("TEST: Meat: " + food_Meat);
alert("TEST: Milk: " + food_Milk);
alert("TEST: Sugar: " + food_Sugar);
alert("TEST: Oil: " + food_Oil); --> always returns NULL

Has anyone encountered this?
I know its not out of range, because it would otherwise return "undefined".

Thanks,
Anthony

1 reply

Badge +4
@Kinon: I tried same code you mentioned above and I am getting all the values captured properly. I pasted your entire code under "Qualtrics.SurveyEngine.addOnPageSubmit(function(type)" event and getting all the values displayed.

Leave a Reply