Hello!I am using the github repo: https://github.com/keita-makino/qualtrics-map to generate a map, based on an address. The function returns the longitude and latitude.I would also like to store the actual address, as well.Here is the JS code:Qualtrics.SurveyEngine.addOnload(function () { document .getElementById(this.questionId) .querySelectorAll('[role*=presentation]')[0].style.display = 'none';});Qualtrics.SurveyEngine.addOnReady(function () { mapRender(apiKeyGoogleMap, document.getElementById(this.questionId));});// If you need to set a default centerQualtrics.SurveyEngine.addOnReady(function () { mapRender(apiKeyGoogleMap, document.getElementById(this.questionId), { location: { lat: 50, lng: -100, }, zoom: 12, // Optional });});#General/Header code: var apiKeyGoogleMap = 'my-key'; var countryCode = '${loc://CountryCode}'; var postalCode = '${loc://PostalCode}';How would I go about saving the actual address, please?Thanks so much,Erin
Hello again:I'm making a bit of progress, but am still struggling with the Qualtrics Variable Names.Here is my updated code:Qualtrics.SurveyEngine.addOnSubmit(function(){ function dateproduce(x) { const myArray1 = x.split(".") var y1 = myArray1[1]; var m1 = myArray1[0]-1; if(m1==-1) { m1 = 12; y1 = y1 - 1; } var dt1 = new Date(y1,m1); return dt1; } var st = "${q://QID3%231/ChoiceTextEntryValue/1/1}"; console.log(st) let dta1 = dateproduce(st); var et = "${q://QID3%232/ChoiceTextEntryValue/1/1}"; let dta2 = dateproduce(et); if(dta2 < dta1) Qualtrics.SurveyEngine.setEmbeddedData('FinalResponse',"incorrect"); else Qualtrics.SurveyEngine.setEmbeddedData('FinalResponse',"correct"); });```The FinalResponse is not getting any value.Any suggestions much appreciated.Sincerely,Erin
Hello!I have 2 dates that will be entered by the user, a starting date and an ending date. Currently, I am using flatpicker to set those up as month/year.What I would like to do is to "compare" the dates, and indicate if the ending date is before the starting date.I know that I can't do that in regular Qualtrics, so I did put together a little Javascript code to do that. I am a Javascript newbie, so please forgive my coding practice. function dateproduce(x) { const myArray1 = x.split(".") var y1 = myArray1[1]; var m1 = myArray1[0]-1; if(m1==-1) { m1 = 12; y1 = y1 - 1; } var dt1 = new Date(y1,m1); return dt1; } var st = "1.2020"; let dta1 = dateproduce(st); document.write(dta1); var et = "1.2021"; let dta2 = dateproduce(et); if(dta2 < dta1) document.write("incorrect date"); else document.write("correct date");```So essentially, I would like to put this in my question, but I don't know how to get the varia
Hello!How are you?I have some JavaScript code that is doing calculations. If the final value is negative, then an alert error message appears. But when I click on the "ok", it takes me to the next question, rather than giving me a chance to correct the error. How can I fix this, please?Here is the code:Qualtrics.SurveyEngine.addOnUnload(function(){ /*Place your JavaScript here to run when the page is unloaded*/ var yro1 = Qualtrics.SurveyEngine.getEmbeddedData("yro"); var yrotext = yro1.substring(0,3); var msg = ' '; console.log("text"); console.log(yrotext); var yri1 = Qualtrics.SurveyEngine.getEmbeddedData("yri"); var yritext = yri1.substring(0,3); console.log("in"); console.log(yritext); if(yrotext!='Don' && yritext !='Don') { var yro1 = parseInt(yro1); console.log("year out"); console.log(yro1); var yri1 = parseInt(yri1); var yrdiff = yro1 - yri1; console.log("yrdiff"); console.log(yrdiff); if(yrdiff
Hello!I added the date question from the Qualtrics library with the month and year.Currently, the starting year is 1900. I would like to have it start at 1978.I changed the JS code, but it still starts at 1900.What do I need to do, please?I can't use flatpickr, because it needs to be in that particular format.Thanks,Erin
Hi everyone!I have 15 date variables that I would like to be able to sort, please, from earliest to latest.How would I go about doing that, please?Thanks,Erin
Hello!What would people suggest as a good way to learn to do custom coding in JavaScript, please?Any help much appreciated.Sincerely,Erin
Hello again!I'm trying to use Flatpicker to set dates in month/year format.I put it in the Look and Feel; General; Header in the source code view.It saves, but when I try to Apply, it never finishes.Any suggestions much appreciated.Sincerely,Erin
Already have an account? Login
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.
Sorry, we're still checking this file's contents to make sure it's safe to download. Please try again in a few minutes.
Sorry, our virus scanner detected that this file isn't safe to download.