Auto-advance on choice selection code doesn't

2019-05-10 15:58发布

问题:

Qualtrics provides some JavaScript that it claims will automatically move participants to the next survey question when they select an answer choice. They have options for single-answer and multiple-answer multiple choice questions, but I only need the former for my survey. I put their code in the correct place, but I can't get it to work. NOTE: I'm trying to make a mobile compatible survey (not just compatible, but very well made for mobile use). Qualtrics' code does not work on mobile devices or on my laptop. I'm not sure if their code is incorrect or if I have to do something else to implement it correctly.

Here's the code for Auto-Advance SINGLE-Answer Multiple Choice questions Qualtrics provides:

    var that = this;
    this.questionclick = function(event,element){
        if (element.type == 'radio')  {
           that.clickNextButton();
        }
    }

Here's the code for Auto-Advance MULTIPLE-Answer Multiple Choice questions Qualtrics provides:

    var that = this;
    this.questionclick = function(event,element){
        if (element.type == 'checkbox')  {
            that.clickNextButton();
        }
    }

Again, I'm only using the former for my survey, but I thought I'd include both anyway. I know Java and C fairly well but I've never learned JavaScript, so I'm not sure how these work with Qualtrics and if this code is correct or if there's something I'm not doing.

Also, if anyone has a solution that isn't in JavaScript (like if there's one in CSS or HTML or something weird) I would appreciate the other options.

Thanks in advance!

回答1:

I'm really not sure why the code did not work before, because now it works perfectly fine:

Qualtrics.SurveyEngine.addOnload(function()
{
    var that = this;
    this.questionclick = function(event,element){
        if (element.type == 'radio')  {
            that.clickNextButton();
        }
    }


});

I'm guessing it was some error on Qualtrics' part because it's the same exact code which is now working.



回答2:

you are correct, it is only set up to work for either single answer multiple choice or multiple answer multiple choice, so it is not meant for additional coding other than that. Here is a site you can use to test it: https://new.qualtrics.com/SE/?SID=SV_1S8i98l8YClkZ5H&Preview=Survey&BrandID=qcorp

Also, Qualtrics can help you troubleshoot code if you give the support team a call.



回答3:

Automatically shift to next question + No Next button (fastest way to navigate through survey)

  1. Enter Javascript view on any question
  2. Copy and delete all code
  3. Paste the following
Qualtrics.SurveyEngine.addOnload(function()
{
    var that = this;
    this.questionclick = function(event,element){
        if (element.type == 'radio')  {
            that.clickNextButton();
        }
    }


});
  1. Enter into HTML view for same question

  2. Add the cursor to the bottom/end of the text

  3. Add the following

<style>
     #NextButton {display:none;}
</style>
  1. Your all done. Preview to test