Modifying Calendar & Date Questions from the Qualtrics Library | XM Community
Skip to main content
Hello! In one of the surveys that I am developing, I am interested in importing/using one of the questions from the Qualtrics Library (Calendar & Date Questions). I am specifically interested in the Calendar & Date Question that is in the SIDE-BY-SIDE format.



There are two things I want to change about this question:

(1) I want to reword the default "Please select:" statement to "Start Date:"

(2) I want to add a second statement for "End Date:"

(3) I want to change the year range from 1900-2049 to 2015-2030 for the dropdown menu options for both of the statements.



At the end of the day, I am hoping to end up with a Side-By-Side question with a "Start Date:" statement and an "End Date:" statement with the response options for the Year dropdown menu to be limited to 2015-2030. I am having difficulties with this.



I am able to easily reword the default "Please select:" statement to "Start Date:" I added a second statement for "End Date:"



Where I run into trouble is that when I go into the Javascript code, I can change the year range from 1900 (min) to 2015 & 2049 (max) to 2030. But this ONLY applies to the first "Start Date:" statement that I originally reworded from the default "Please select:" statement. For the statement that I added ("End Date:"), the dropdown menu options are still ranging from 1900 to 2049. Is there anything I can do to change this?

There is code marked "This all remains the same" it it calling out only the first row of the side-by-side where you see #3~1 is referring to the first row of third column:
var yr = document.getElementsByName('QR~'+ qid + '#3~1')[0]
to apply the date range to both rows you need to do some updating that instructs the program to change both lists. This isn't written efficiently but it works:
var yrStart = document.getElementsByName('QR~'+ qid +'#3~1')[0];
var yrEnd = document.getElementsByName('QR~' + qid + '#3~2')[0];

//adjust existing code from yr to yrStart
var j=yearLast-1898;
for(i=j;i<151;i++){
yrStart.remove(j);
}
for(i=1; i<=yearFirst-1900; i++){
yrStart.remove(1);
}

//repeat this prior chunk of code and change from yrStart to yrEnd
var j=yearLast-1898;
for(i=j;i<151;i++){
yrEnd.remove(j);
}
for(i=1; i<=yearFirst-1900; i++){
yrEnd.remove(1);
}



Leave a Reply