Question

What JavaScript function will auto-submit a Qualtrics survey? I want to create a button in the header or footer of a Qualtrics survey that will automatically submit the survey whenever the user wants to quit. It seems like a pretty standard feature for survey software to have. The question may not seem well researched but that's because there are NO Qualtrics resources out there on this.

I found parts of the Qualtrics JS that might be relevant:

function pressSubmitButtonOnEnter(evt, id) {
    if (evt.keyCode == Event.KEY_RETURN) {
        Event.stop(evt);
        $(id).click();
        return false;
    }
}

This one as well:

function submitForm(formID) {
    var form = $(formID);
    if (form) {
        Event.fire(form, 'submit');
        if (form.onsubmit)
            form.onsubmit();
        if (form.submit)
            form.submit();
        return true;
    }
}
function submitFormJumpTo(formID, jumpTo) {
    $(formID).action = jumpTo;
    submitForm(formID);
}

This:

var SEonSubmit = {
    add : function (onSubmitFunction) {
        Event.observe('Page', 'submit', onSubmitFunction);
    }
};
var SEonClick = {
    add : function (onClickFunction) {
        Event.observe('Page', 'click', onClickFunction);
    }
};
Was it helpful?

Solution

According to Qualtrics, there is no way to do this. I submitted a request feature.

OTHER TIPS

This question is still relevant almost seven years later. I just spent a crazy amount of time trying to get this to work, it is exceptionally poorly documented.

The page with the intercept will have the QSI.API object.

QSI.API.load()
QSI.API.run()

Site Intercept JavaScript API

https://s.qualtrics.com/WRAPI/SiteIntercept/JavaScript/classes/API.html

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top