At Qualtrics, how to save embedded data using javascript (given that qualtrics has recently been updated and the old SO solution no longer works)

A few months ago, I used some great advice here to create a poll in Qualtrics with some javascript code that saved people the answers (given by moving the slider) as inline data. It all depends on the ability to call some functions when you click the "Next" button, as shown in the $('NextButton').onclick = function (event)link above.

I wanted to reuse this survey this weekend, and found that the data was no longer being saved. Having caught a little, I realized that at present any such function will now be launched only when the "Next" button is pressed the first time, and not at any subsequent time. In other words, the exact same javascript will either work or do nothing depending on whether it happens the first time you click the next button.

I forwarded Qualtrics asking for advice, and their support person was mailed with the following message:

The old application that conducted our polls will reload the page every time you go to a new page in the survey. The current application that conducts our polls is a one-page application, and going to the next page in the survey does not refresh the entire page, it just presents another section.

I could not find anything on the Qualtrics website to get more information about the update mentioned above or to indicate if there is a new CSS selector that can be used to select the currently displayed "next" button, replacing $ ("NextButton" )), and I have no idea how to reverse engineer the Qualtrics survey webpage to understand myself.

- , Qualtrics? - , , , .

, , , , , - . , Qualtrics.

+1
2

Qualtrics : SE JFE. Qualtrics JFE. Qualtrics SE, Q_JFE = 0 . .

, NextButton SE JFE. Qualtrics , . - JavaScript, NextButton, , , , NextButton. .

+2

T.Gibbon Q_JFE=0 , "" ( , - , - , ).

Qualtrics, , , , .

document.getElementById('NextButton').addEventListener(function (event) {
doStuff();
});

, , , javascript, , , " ", , , , "next".

, , ( ), , . ( "q1ID" ). .

Qualtrics.SurveyEngine.setEmbeddedData('q1ID', this.getQuestionInfo().QuestionID);

, , :

Qualtrics.SurveyEngine.addOnload(function()
{
    var tags = ['q1','q2', 'q3'];

    var pipedStrings = {'QID356':'${q://QID356/TotalSum}',
        'QID357':'${q://QID357/TotalSum}',
        'QID358':'${q://QID358/TotalSum}'};

    tags.forEach(function(tag) {
        var qID = Qualtrics.SurveyEngine.getEmbeddedData(tag + 'ID');
        var response = pipedStrings[qID];
        Qualtrics.SurveyEngine.setEmbeddedData(tag, response);

    });
});

, :

tags.forEach(function(tag) {
        var qID = Qualtrics.SurveyEngine.getEmbeddedData(tag + 'ID');
        var response = '${q://' + qID + '/TotalSum}';
        Qualtrics.SurveyEngine.setEmbeddedData(tag, response);

    });

, Qualtrics , ​​. , , , pipedStrings, , ( , ).

, tags. - , , , .

+1

Source: https://habr.com/ru/post/1534940/


All Articles