My script is selecting all options instead of the ones that I want! | XM Community
Skip to main content
I am completely new at scripting. I wrote this script using examples that I have found but it isn't working the way that I want it to. It is selecting every option, no matter what I say at QID108. I don't know if it matters or not, but not everybody will be shown all 3 options at QID108...Can anybody please help me with what I am doing wrong!!!



Qualtrics.SurveyEngine.addOnload(function()

{

/*Place your JavaScript here to run when the page loads*/

var Month1="${q://QID108/ChoiceNumericEntryValue/1}";

var Month2="${q://QID108/ChoiceNumericEntryValue/2}"

var Month3="${q://QID108/ChoiceNumericEntryValue/3}"



if (Month1="1" ) {this.setChoiceValue(1,true) ; }

if (Month1=>"1" ) {this.setChoiceValue(2,true) ; }

if (Month1=>"2" ) {this.setChoiceValue(3,true) ; }

if (Month1=>"3" ) {this.setChoiceValue(4,true) ; }

if (Month1=>"4" ) {this.setChoiceValue(5,true) ; }

if (Month1=>"5" ) {this.setChoiceValue(6,true) ; }



if (Month2="1" ) {this.setChoiceValue(7,true) ; }

if (Month2=>"1" ) {this.setChoiceValue(8,true) ; }

if (Month2=>"2" ) {this.setChoiceValue(9,true) ; }

if (Month2=>"3" ) {this.setChoiceValue(10,true) ; }

if (Month2=>"4" ) {this.setChoiceValue(11,true) ; }

if (Month2=>"5" ) {this.setChoiceValue(12,true) ;}



if (Month3="1" ) {this.setChoiceValue(13,true) ; }

if (Month3=>"1" ) {this.setChoiceValue(14,true) ; }

if (Month3=>"2" ) {this.setChoiceValue(15,true) ; }

if (Month3=>"3" ) {this.setChoiceValue(16,true) ; }

if (Month3=>"4" ) {this.setChoiceValue(17,true) ; }

if (Month3=>"5" ) {this.setChoiceValue(18,true) ; }















});
What are you trying to have happen? I'm no coding genius but I may be able to help you with Embedded Data and survey logic.

Leave a Reply