How do I generate a custom error message without forced response? | XM Community
Question

How do I generate a custom error message without forced response?

  • 23 October 2020
  • 2 replies
  • 94 views

I am trying to generate an error message on a question if the participant uses less than 2 characters to respond. The question cannot be a forced response and I would like to customize the error response. Thoughts? Options?


2 replies

Userlevel 6
Badge +21

Hi mrue
Use the below code and add in JavaScript onload options.. hope this helps
note: please checkout for non-English characters
/*Place your JavaScript here to run when the page loads*/
var that = this.questionId;
jQuery("[id='QR~"+that+"']").focusout(function(){
var myLength = jQuery("[id='QR~"+that+"']").val().length;
if(myLength <= 2){
alert("Please enter the text more than two characters");
}
});

Userlevel 7
Badge +27

https://www.qualtrics.com/community/discussion/12977/how-do-i-generate-a-custom-error-message-without-forced-responseYou can use custom validation. The condition would be the field can be empty or match a regex that matches two or more characters:

^.*{2,}$

Leave a Reply