Has anyone had problems with JavaScript code running for some respondents but not others? | XM Community
Skip to main content

I've written some JavaScript code that is used to validate responses. I've done a soft launch (200 responses) and it seems like in ~5% of cases the JavaScript validation code may not have run even though the relevant questions have been displayed. My suspicion is that it's something to do with the OS or browser that the respondent is using but the meta data don't show anything obvious in this regard (e.g. all IE cases). Has anyone found that their JavaScript runs for some respondents but not others? What was the cause?
I'm not posting any code because it runs fine in preview mode and for most respondents. I'm also in the process of trying to modify it to gather more information about what is going on.

That's a pretty good assumption about the browser or OS considering the widespread success in the soft launch and preview. Are you using pure JavaScript or JS + jQuery? jQuery has different compatibilities than vanilla JS. In your ~5% of cases that didn't pick up the validation, are their any patterns you can identify?
Maybe test what a user entered in preview to make sure no values are slipping through the cracks. If all values are accounted for and you're still seeing the problem, you could use setEmbeddedData() at the beginning of your script to add a pseudo feature flag that would set 0 to 1 when running. Checking this EmbData value in the data set would let you know for sure that a respondent's validation did run. Just some ideas, hope they helped!


Leave a Reply