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?
The page reloads when there is a validation error.
EDIT - spoke to Qualtrics customer support today and found out that the page does not reload
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.
Oh wow interesting.. Good to know - thanks!
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
Thanks TomG for the guidance - that was the bit I was missing! :)
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?
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.
Thanks TomG! I shall create a new discussion for your first suggestion. Appreciate your advice please. Thank you.
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 ...
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.
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! :)
Try changing addOnload to addOnReady.
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
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.
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!
Have your JS examine the rows and display the rows up to and including the last row that has an answer.
Leave a Reply
Enter your E-mail address. We'll send you an e-mail with instructions to reset your password.