If you have concerns that survey participants are using AI to generate open-ended responses, you can follow the steps in this article to block them from copying and pasting text into Open End question fields. This script is slightly different from the other ones in the Modern Surveys Script Library in that it uses the Embedded Content element, instead of the Scripting > On Load or On Complete tabs at the survey page level.
This script works with the following question types:
- Short Answer
- Long Answer
Important: Using this script may pose an accessibility barrier to survey participants, as some assistive technologies leverage copying and pasting. Only use this script if you are confident a large percentage of the responses will be poor quality (for example, if you are using an open sample).
Detailed Steps
- Add an Open End question to your survey as desired.
- On the same survey page as the Open End question, just before the Open End question, add an Embedded Content element.
- In the Table of Contents, click the Embedded Content element to open it for editing.
- Copy and paste the following script into the Embed content field.
Note: Embedded Content elements do not work in survey preview, so testing this in survey preview will not work. Instead, get a test activity link.
Script
<script> // How do I prevent survey participants from copying and pasting answers into Open End questions? (Modern Surveys)
// To ensure your script works as expected, always copy the original script from the Script Library found in the Alida Help Center. Failure to use the latest script from the script library may cause unexpected results.
const elems = document.getElementsByTagName("textarea");
for(let i=0; i < elems.length; i++) { elems[i].addEventListener('paste', (event) => { event.preventDefault(); }); } const elemText = document.getElementsByTagName("input");
for(let i=0; i < elemText.length; i++) { if(elemText[i].type.toLowerCase() == 'text') { elemText [i].addEventListener('paste', (event) => { event.preventDefault(); }); } }
</script>
Comments
0 comments
Article is closed for comments.