How to fix: Auto-advance does not work after the warning "please answer this question" | XM Community
Solved

How to fix: Auto-advance does not work after the warning "please answer this question"


Badge

In my task, participants are given forced response text entry questions. After they fill the box, they have to click on the "submit" (multiple choice question) button below and proceed. Please see the images below.

However, when I click on the submit button without filling the box and receiving the warning, I cannot proceed even if I fill the box later.

Any help is much appreciated.
Thank you

image.pngimage.pngI cannot proceed even if I fill the box, after this warning

icon

Best answer by bgooldfed 20 May 2022, 03:16

View original

3 replies

Userlevel 5
Badge +25

Hi belgind,
Most likely because the submit option is still ticked (from memory multiple choice options don't untick when an error/message triggers).
May I ask why you're using a multiple choice option in place of a submit button? You'd likely have an easier time adding code to a question on that page that modifies the usual "Next" button:
jQuery("#NextButton").val('Submit');
jQuery("#NextButton").css({"width": "99%", "background-color": "#007ac0"});  //add whatever styling you want
This will behave the way you require.

Badge

Becasue I removed all "next buttons" since I am conducting time-restricted experiment. They were distracting. But your solution worked though. When I hit enter, the experiment proceed thank you!


Is there any way to proceed when participants press left and right arrows? and record which one they pressed?

Userlevel 5
Badge +25

Yes there is! GIve this a go
(my Qualtrics is down right now, this is untested)
//add this to the onLoad function

//detecting arrow key presses
document.addEventListener('keydown', function(e) {
//check which key was pressed
    switch (e.key) {
        case "ArrowLeft":
//set the pressed key in the embedded data - or store it however else you want
Qualtrics.SurveyEngine.setEmbeddedData("keyPressed", "Left key");
//press the next button
function () {document.getElementById('NextButton').click()}
            break;
        case "ArrowRight":
Qualtrics.SurveyEngine.setEmbeddedData("keyPressed", "Right key");
function () {document.getElementById('NextButton').click()}
            break;
    }
});
Good luck!

Leave a Reply