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

Bring cursor back to question with error

  • November 11, 2022
  • 6 replies
  • 56 views

Forum|alt.badge.img+1

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!

6 replies

Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • November 11, 2022

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!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5909 replies
  • November 11, 2022

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?


Forum|alt.badge.img+1

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.


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5909 replies
  • November 11, 2022

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


Deepak
QPN Level 8 ●●●●●●●●
Forum|alt.badge.img+44
  • 1549 replies
  • November 11, 2022

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!


Forum|alt.badge.img+1

TomG this worked, thank you kindly!


Leave a Reply