过早退出Qualtrics中的“循环并合并"块 [英] Prematurely exiting a Loop and Merge block in Qualtrics

查看:95
本文介绍了过早退出Qualtrics中的“循环并合并"块的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我目前正在进行Qualtrics调查,受访者必须解决一长串字谜,然后回答一些人口统计问题.

为了简化字谜部分,我使用了循环并合并"块:第一个字段是要解决的字谜,第二个字段是字谜的解,因此调查可以检查答案.受访者反对每个字谜的解决方案.

现状是,调查工作正常:但是,我希望允许受访者过早退出循环,方法是在响应字段中输入"EXIT",然后将他们重定向到下一个问题块(人口统计问题).

这通常是使用跳过"逻辑实现的:但是,跳到块的末尾并不能解决问题(循环重新启动).我设法将它们重定向到调查的结尾,但没有重定向到人口统计问题块.

有没有一种方法可以使用JavaScript来跳到人口统计数据块或退出循环并过早合并数据块?我是否缺少可以解决问题的Qualtrics选项?

解决方案

如果这仍然与您相关:我需要相同的功能,这就是我的解决方法:首先,我定义一个辅助变量,将其命名为 EndLoop ,我将其初始化为0.然后我设置了一个函数,在人们按下按钮后将EndLoop的值更改为1,此外,我还在循环中的问题中添加了显示逻辑,仅当EndLoop时才显示它们仍为0,并在EndLoop为1时立即隐藏问题.

这是分步说明以及javascript和html代码.

粗体部分是您需要做的事情,要点是更详细的操作说明.

1.在循环合并之前,定义嵌入式数据字段(称为 EndLoop )并将其初始化为0.

  • 转到调查流程"面板
  • 添加新元素>选择嵌入式数据字段
  • 将字段命名为"EndLoop"
  • 通过点击立即设置值"链接,将其值t0设置为数字0
  • 确保将其移动到合并和循环块之前

2.对于循环中的每个项目设置显示逻辑以"EndLoop" = 0为条件显示它们

  • 转到循环中每个问题的选项菜单
  • 选择添加显示逻辑"
  • 从第一个下拉菜单中选择嵌入数据"
  • 打开一个新类型字段>作为名称键入 EndLoop +选择等于" +输入0作为值

3.在用户应该可以选择退出的页面上插入自定义按钮.该按钮运行一个名为setEndLoop()onclick的用户定义函数.

  • 点击按钮应该出现的问题
  • 在问题文本的右上方,选择"html视图"
  • 我使用的代码是:

     <输入id ="css-class-mybutton" onclick ="setEndLoop()" value =完成" type ="button"> 

  • 如果要更改按钮文本,请在 value ="done"

  • 中更改"done"

4.使用自定义javascript定义函数setEndLoop(),将EndLoop的值更改为1并模拟下一个按钮单击

  • 转到循环中每个问题的选项菜单
  • 选择添加JavaScript"

我使用的代码是:

 /*获取EndLoop变量*/var EndLoop ="$ {e://Field/EndLoop}";Qualtrics.SurveyEngine.addOnload(function(){/*隐藏上一个和下一个按钮*/$('NextButton')&&$('NextButton').hide();$('PreviousButton')&&$('PreviousButton').hide();/*功能:点击用户定义的按钮->更改字段EndLoop */var that = this;setEndLoop = function(){Qualtrics.SurveyEngine.setEmbeddedData('EndLoop',1);that.clickNextButton();};}); 

该按钮将没有默认样式,因此,定义一个自定义css来为您的按钮设置样式,使其看起来像主题的按钮.我在这里使用的按钮的类名称是 id ="css-class-mybutton" ,在CSS中使用 .css-class-mybutton {...} .

希望有帮助.

I'm currently working on a Qualtrics survey in which respondents have to solve a long list of anagrams, and then answer some demographic questions.

To make the anagram part easier, I've used a Loop and Merge block: the first field is the anagram to be solved, the second field is the solution of the anagram, and the survey can therefore check the answer of the respondent against the solution for each anagram.

As it is, the survey is working perfectly: however, I'd like to allow respondents to prematurely exit the loop by typing "EXIT" in the response field, and to redirect them to the next question block (the demographic questions).

This is typically something that is achieved using "Skip" logic: however, skipping to the end of the block does not do the trick (the loop restarts). I managed to redirect them to the end of the survey, but not to the demographic question block.

Is there a way to use javascript to jump to the demographic block or exit the loop and merge block prematurely? Am I missing a Qualtrics option that would do the trick?

解决方案

If this is still relevant to you: I needed the same functionality and this is how I solved it: First, I define a helper variable, call it EndLoop, which I initialize to 0. Then I set up a function to change the value of EndLoop to 1 after people hit a button, additionally I add a display logic to the question in the loop showing them only if EndLoop is still 0 and hiding the questions as soon as EndLoop is 1.

This is a step-by-step instruction and the javascript and html code.

The bold stuff is what you need to do, the bulletpoints a more detailed instruction how to do it.

1. Before your loop-and-merge define an embedded data field called EndLoop and initialize it as 0.

  • Go to the Survey Flow Panel
  • Add a new element > select embedded data field
  • Name the field 'EndLoop'
  • Set its value t0 the number 0 by click on the link "set value now"
  • Make sure you move it before the merge-and-loop block

2. For each item in the loop set a display logic to show them conditional on 'EndLoop' = 0

  • Go to the options menu of each question in the loop
  • Select "add display logic"
  • Select "Embedded Data" from the first dropdown menu
  • A new type field opens > as name type EndLoop + select "is equal to" + type 0 as value

3. Insert a customized button into the page where people should be able to opt-out. The button runs a user-defined function called setEndLoop() onclick.

  • Click on the question where the button should appear
  • On the top-right of the question text select "html view"
  • The code I used is:

    <input id="css-class-mybutton" onclick="setEndLoop()" value=" done " type="button">
    

  • If you want to change the button text, change the " done " in value = " done "

4. Define the function setEndLoop() using custom javascript to change the value of EndLoop to 1 and emulate a next button click

  • Go to the options menu of each question in the loop
  • Select "add JavaScript"

The code I used is:

    /* Get the EndLoop variable */
    var EndLoop = "${e://Field/EndLoop}";

    Qualtrics.SurveyEngine.addOnload(function(){

        /* hide previous and next button */
        $('NextButton') && $('NextButton').hide();
        $('PreviousButton') && $('PreviousButton').hide();

        /* Function: on click on user-defined button -> change the field EndLoop */
        var that = this;

        setEndLoop = function(){
            Qualtrics.SurveyEngine.setEmbeddedData('EndLoop', 1);
            that.clickNextButton();
        };
    });

The button will not have the default style, thus, define a custom css to style your button to look like the buttons of your theme. The class name for the button I used here is id="css-class-mybutton", use .css-class-mybutton{ ... } in the css.

Hope that helps.

这篇关于过早退出Qualtrics中的“循环并合并"块的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆