Does the page reload if validation fails? | XM Community
Skip to main content
Solved

Does the page reload if validation fails?


Forum|alt.badge.img

I'm working on a project in which participants are asked a question with multiple choice and text entry and I have a custom validation set up. I would like to use some javascript to track some information and was wondering if the page reloads every time an individual fails the validation or whether it just loads the first time you arrive at the page and that's all?

Best answer by KS28

EDIT - spoke to Qualtrics customer support today and found out that the page does not reload

View original

19 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • April 7, 2020

The page reloads when there is a validation error.


Forum|alt.badge.img
  • Author
  • 5 replies
  • Answer
  • April 7, 2020

EDIT - spoke to Qualtrics customer support today and found out that the page does not reload


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • April 7, 2020

EDIT - spoke to Qualtrics customer support today and found out that the page does not reload

They gave you the wrong answer. Maybe they answered from a JFE virtualization perspective, but from a JavaScript perspective the page reloads and the addOnload and addOnReady functions are executed.


Forum|alt.badge.img
  • Author
  • 5 replies
  • April 7, 2020

Oh wow interesting.. Good to know - thanks!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • April 7, 2020



Forum|alt.badge.img+11
  • Level 3 ●●●
  • 331 replies
  • May 13, 2021

Is there a way to call an onload function from a button on a page via a bit of extra HTML code in a question? I ask this as I have an iframe with a PDF file in which sometimes it displays and sometimes it doesn't. I found that using a forced question helps to reload the pdf file but I'd rather find a nicer solution to reloading the pdf file
Thanks
Rod Pestell


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • May 15, 2021

Forum|alt.badge.img+11
  • Level 3 ●●●
  • 331 replies
  • May 18, 2021

Thanks TomG for the guidance - that was the bit I was missing! :)


  • 8 replies
  • May 20, 2021

Dear TomG,
I am trying to validate a SBS question by using custom validation. However, as you indicated above, the page reloads whenever the validation fails. This causes the JS codes to reload as well, and mess up the revealing sequence of the statements and columns.
May I ask whether you have any solution to work around this? Is it possible to still use custom validation while suppressing the reload?
image.png


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • May 20, 2021

You can't suppress the reload when using custom validation.
I'm not sure what your JS does, but if it were me, I would write it to gracefully recover when the page reloads.
Your other option would be to disable the Next button, do the validation with JS and enable the Next button when the validation criteria is met.


  • 8 replies
  • May 21, 2021

Thanks TomG! I shall create a new discussion for your first suggestion. Appreciate your advice please. Thank you.


  • 5 replies
  • May 21, 2021

Are we 100% sure validation reloads the whole page?
I'm very much a javascript noob but I also spoke to support and was also told that the entire page doesn't reload.
Also if the javascript functions executed again i don't think i'd have my own problem where css overrides javascript after a validation error ...


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • May 21, 2021

https://www.qualtrics.com/community/discussion/comment/37562#Comment_37562What you are seeing is probably a timing issue that you need to adjust for in your JS code.


  • 5 replies
  • May 21, 2021

Ah okay my bad. Wouldn't have thought timings would have been involved in something as simple as
Qualtrics.SurveyEngine.addOnload(function()
{
   var NextButton = document.getElementById("NextButton");
   NextButton.style.display = "block";
});
I shall brush up on my javascript! :)


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • May 21, 2021

Try changing addOnload to addOnReady.


  • 5 replies
  • May 21, 2021

I had previous tried it in both and had the same problem
Anyway thanks! because I thought about what you said about timings and wrote this which fixes (or papers over) the problem. Hacky as hell but works 🙂

image.png


Forum|alt.badge.img
TomG wrote:

You can't suppress the reload when using custom validation.
I'm not sure what your JS does, but if it were me, I would write it to gracefully recover when the page reloads.
Your other option would be to disable the Next button, do the validation with JS and enable the Next button when the validation criteria is met.

@TomG : I came across this post and had a related follow-up question if you don’t mind.

 

I’ve successfully used JS to add a button below a matrix question; when users click the button, it adds an additional row to the bottom of the matrix. However, if the custom validation I’ve created (via the regular Qualtrics interface; not via JS) fails when the user clicks the ‘next’ button, then the page reloads. And when the page reloads, the previously exposed extra row(s) at the bottom go back to being invisible. Yes, when the user re-clicks the custom button, their previously entered selections on that extra row are still there. But I’d prefer the row(s) previously exposed to remain visible on page reloading.

 

You said in this post that you’re suggest writing the JS to recover when the page re-loads. I’m curious how to do that? Thanks!


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5863 replies
  • June 24, 2024

Have your JS examine the rows and display the rows up to and including the last row that has an answer.


Forum|alt.badge.img

@TomG: Hate to trouble you, but any chance you could actually provide such a code? Sorry!