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

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

  • October 23, 2020
  • 2 replies
  • 140 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

PraDeepKotian_XM
QPN Level 5 ●●●●●
Forum|alt.badge.img+21
  • QPN Level 5 ●●●●●
  • 228 replies
  • October 24, 2020

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");
}
});


TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • 5935 replies
  • October 24, 2020

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,}$