Highlight error in large side-by-side where email address in incorrectly entered | XM Community
Skip to main content

Hi community.

I have a large side-by-side table with open ended text entry fields.  The open text entry must have correct email address format.  Not all fields will need text entry.  When an email address is incomplete or has the wrong format, I need to find a way to highlight the field, column or row to make it easier for the respondent to find their error.  This code is not working for me.  Any feedback or suggestions from the community would be greatly appreciated.

Qualtrics.SurveyEngine.addOnload(function()
{
    $(document).ready(function(){

$(".InputText").on("input",function(){

if ($(this).val() == "")
$(".InputText").css({backgroundColor:""});

else {
if (checkEmail($(this).val()))
$(".InputText").css({backgroundColor:""});
else
$(".InputText").css({backgroundColor:"red"});
}
})

function checkEmail(txt) {
var patt = />a-zA-Z0-9._%+-]+@-A-Za-z0-9.-]+\.ZA-Za-z]{2,3}$/;
if(patt.test(txt))
return true;
else
return false;
}
})

});

 

 

 

Fantastic information.  Thank you for sharing.

 


@EY_AL 

The below post should be helpful:

Need javascript code for highlighting unanswered row of matrix question | XM Community (qualtrics.com)

You can achieve the same view via Matrix type question.


Thanks Deepak. I’ll check this out.


Leave a Reply