How do I prepare a multiline textarea to pass through Qualtrics Response API? | XM Community
Skip to main content

I have tried all sorts of regex javascript etc. It seems to break with line breaks\\newlines ("\\n") and quotes (single and double).

I was able to put some regex and replace functions together to make it work.

Qualtrics.SurveyEngine.addOnPageSubmit(function()
{
var input = jQuery("#"+this.questionId+" .InputText");
input.val(input.val().replaceAll('"',""));
input.val(input.val().replace(/(\\r\\n|\\n|\\r)/gm, " "));
});


Leave a Reply