Validation Requirement pass after one try | XM Community
Skip to main content

Hello,

I have added a validation requirement to a question. However, I want to give participants only one time to revise their answer and then they should be able to move on to the next question. Is there any way to do that?

 

Thank you in advance!

Hi @anleta ,

I am assuming you’re using Custom Validation(if not you can simply achieve it by using Required Response) .
So , to achieve this you have to create a hidden text type question and sets it default value to 1:
 


Then create an embedded data count and sets it value to 0.

Now on question on which you want to achieve above validation add below JS code:
 

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{



setTimeout(function() {
document.getElementById('NextButton').addEventListener("click", setValue);
function setValue() {

Qualtrics.SurveyEngine.setEmbeddedData('count', 5);
}

}, 4000);

});

Qualtrics.SurveyEngine.addOnUnload(function()
{
document.getElementById('NextButton').removeEventListener()

});

And below validation logic in new logic set:


One heads up , based on how slow is the survey , you have to customize the setTimeout variable delay(4000) so as it corresponds to your survey.

Hope this resolves your query😊!!

 


Thank you very much! So is Q35 another question that I add and hide? Or is it supposed to be the question that I wish to add the validation for?

 


Hi @anleta ,

Q36 will be a hidden Text type question with its default value set at “1”  and it set to auto advance through timer or JS which ever you prefer.
This is punched just to get some value to compare to!

Q35 will be your question on which you are applying  validation.

 

Hope this resolves your query😊!!
 


Ok perfect, that helps a lot. Thank you so much! And how can I set up Q36 to auto advance?


Hi @anleta ,

You can achieve it by  using below methods:

By JS:
Add this code to your question and make sure it is not forced response or required response on it :
 

Qualtrics.SurveyEngine.addOnload(function()
{
/*Place your JavaScript here to run when the page loads*/

});

Qualtrics.SurveyEngine.addOnReady(function()
{document.getElementById('NextButton').click();


});

Qualtrics.SurveyEngine.addOnUnload(function()
{
/*Place your JavaScript here to run when the page is unloaded*/

});

By timer :
Add a timer question without page break with question you want to auto advance :

 


Hope this resolves your query😊!!​​​​​​​


Ok thank you, but then the participant will be able to click next when the time is up correct?

I would like to have it such that they can click next after trying once and then they get shown the warnings for the validation requirements but can continue no matter if they fulfilled the other requirements


Leave a Reply