Checking if error message is displayed or not | XM Community
Skip to main content
Solved

Checking if error message is displayed or not

  • September 27, 2018
  • 2 replies
  • 65 views

JanaJarecki
Hi all, I have a delayed question appearing after a timeout. Participants need to answer it correctly, if not qualtrics validates with the inbuilt validation. The challenge: on failed validation, the page reloads, executing the onload jquery code again --> The delayed question is delayed again. Instead it should condition the delay to be executed only the first time the page loads: my approach: if the error msg is not shown, set delay = 0. I tried checking the css property of the ValidationError like so `if ( jQuery(".ValidationError").css("display") == "none" ) { ... }` but this doesn't work. How to check if the validation failed? Thanks, Jana

Best answer by TomG

Try this: ``` if(jQuery("#"+this.questionId+" .ValidationError").is(":hidden")) { ... } ```

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • September 27, 2018
Try this: ``` if(jQuery("#"+this.questionId+" .ValidationError").is(":hidden")) { ... } ```

JanaJarecki
  • Author
  • September 27, 2018
Hi Tom, thank you for the quick response. Unfortunately that doesn't to the trick: Adding it within `addOnReady`, it fires even when the validation error is going to be displayed. EDIT Adding it also to `addOnload` it worked. Thank you!