Bring cursor back to question with error | XM Community
Skip to main content

Hello, I'm looking for a way to allow your cursor to be brought back to a question that has invalid custom validation when trying to move to the next page. This seems to work will with numerical validation, but not custom. Would appreciate any insight!

kathrynmacrae
Have you tried using this to trigger on the Next Button click?
jQuery("#"+this.questionId).find(".VaildationError");
Post which you can check if there is an error or not and include code to move cursor accordingly.
You can check this thread as well.
Hope it helps!


kathrynmacrae,
You need to be a bit more specific:

  • Do you want to focus on a text entry field (i.e., place cursor in field)?

  • What type of question are you using?

  • What is the custom validation?


TomG I just want my page to scroll back up to the question that errored, right now it goes back to the top and you have to scroll to find the question in error.
This is a side by side question with 2 columns and 4 cells in each, all text entry. There is a lot of custom validation on Min/Max, Cell 2 needs to be greater than Cell 1, etc... around 48 rules.


https://community.qualtrics.com/XMcommunity/discussion/comment/52060#Comment_52060Try this:
Qualtrics.SurveyEngine.addOnReady(function() {
jQuery(".ValidationError:visible").first().get(0).scrollIntoView();
});


kathrynmacrae
You can also highlight the cells like it's mentioned in the below thread. You will have to modify it a bit for side by side.
Need javascript code for highlighting unanswered row of matrix question — XM Community (qualtrics.com)
Hope it helps!


TomG this worked, thank you kindly!


Leave a Reply