In Qualtrics, using JavaScript with embedded data and survey responses

Qualtrics allows JavaScript in the survey questions.  However, when reading and writing embedded data based on survey responses using JavaScript, the syntax is a little weird.  This post walks through an example of using JavaScript to …
(1) read embedded data (strings and numbers)
(2) accept survey responses, and
(3) change the embedded data based on the survey responses (i.e., conditional processing).
Continue reading “In Qualtrics, using JavaScript with embedded data and survey responses”

JavaScript for Customized Qualtrics Questions

Years ago, I wrote my online questionnaires from scratch with client-side JavaScript and Perl.  Nowadays, I’ve moved almost entirely to Qualtrics.  Creating and managing online questionnaires with Qualtrics is so easy that I’ve been spoiled by it.

However, I had a task I couldn’t accomplish with the typical question types, so I wrote a JavaScript solution for customizing Qualtrics questions.  I’m posting the solution here in case it’s useful to other people.  This mock-up questionnaire is an example of the sort of customized questions that could be created. The basic approach I describe below is straightforward, so you could adapt my JavaScript code to your favorite web programming language. Continue reading “JavaScript for Customized Qualtrics Questions”

Javascript for Qualtrics: performing mathematical operations on quantitative responses

In Qualtrics, I needed to take a quantitative survey response, do some mathematical operations to the response, and then (1) display the output to the survey respondent and (2) write the output to the Qualtrics dataset. It turns out this is a little tricky, but as described in this post, Javascript can do this task nicely. Continue reading “Javascript for Qualtrics: performing mathematical operations on quantitative responses”

Qualtrics branching based on the average of a multiple-item scale

In a recent project, I identified a work-around for one of the limitations of Qualtrics.  In my situation, I had a three-item scale from a published source (each item measured on a 1-to-7 response scale), and I had a series of follow-up questions that I wanted to ask, but only if the person had averaged 2 or more on the three-item scale.  In other words, I wanted to have a skip pattern based on the average of three previous responses.  Qualtrics makes it easy to have a skip pattern based on the result of one previous response (with the “add skip logic” function shown here).  However, the “add skip logic” in Qualtrics is not flexible enough to do branching based on a combination of previous responses.

A work-around for this limitation Continue reading “Qualtrics branching based on the average of a multiple-item scale”

Javascript for Qualtrics to alter choice options

Here is some Javascript code for altering the current question’s multiple-choice options based on the respondent’s answer to a previous multiple-choice question. Specifically, this code considers the response given to a previous question and modifies the current question to remove any answer options that are lower than the previous response. [Note: I hard-coded the number of options as 10. If there are fewer than 10, it will not throw an error.]

Continue reading “Javascript for Qualtrics to alter choice options”

The CSS I add to a new Qualtrics survey

To my eye, the “page width” used by Qualtrics with most of their themes is too narrow. Even on a small-screen laptop, it leaves a lot of side margin.  The issue isn’t merely aesthetic; a wider screen gives me a little more room for wider labels above closed-ended response options.

I use the following CSS code to give a little more width to the space Qualtrics uses for survey questions. This code is added in Qualtrics “Look & Feel,” under “Style.”

Continue reading “The CSS I add to a new Qualtrics survey”