Community Groups are officially here!
We've released Groups, a new feature that enables us to connect community members of similar industries and interests in a shared, private space. You can check out all of the details here, including information about who can join, how to join, and what Groups are currently offered. Please leave your feedback through this Community Groups Feedback Survey.

Checking if error message is displayed or not

JanaJarecki
JanaJarecki Community Member, Qualtrics Brand Admin Qubie ✭
edited September 2018 in Custom Code

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

  • TomG
    TomG Raleigh, NCCommunity Member, Qualtrics Brand Admin Wizard ✭✭✭✭✭
    Accepted Answer

    Try this:

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

Answers

  • JanaJarecki
    JanaJarecki Community Member, Qualtrics Brand Admin Qubie ✭
    edited September 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!