Copy Paste Prevention - "Form" style text entry questions | XM Community
Skip to main content
Solved

Copy Paste Prevention - "Form" style text entry questions

  • September 28, 2018
  • 2 replies
  • 406 views

I am trying to prevent people from pasting into a a from-style text entry question in a survey I am creating. I have a code that prevents Copy/Paste into a typical text box (works for "single line", "multi line", "essay text box," and "password" text entries); but, it does not work with "form" text entry boxes. Does anybody have an effective copy/paste Javascript that works with form-style questions?

Best answer by TomG

This should work on any type of text inputs in a question: ``` Qualtrics.SurveyEngine.addOnload(function() { jQuery("#"+this.questionId+" textarea,input[type=text]").on("paste", function(e) { e.preventDefault(); }); }); ```

2 replies

TomG
Level 8 ●●●●●●●●
Forum|alt.badge.img+27
  • Level 8 ●●●●●●●●
  • Answer
  • September 28, 2018
This should work on any type of text inputs in a question: ``` Qualtrics.SurveyEngine.addOnload(function() { jQuery("#"+this.questionId+" textarea,input[type=text]").on("paste", function(e) { e.preventDefault(); }); }); ```

  • Author
  • September 28, 2018
This is perfect! Thank you!