Disable cut, copy, paste or right-click on a page or element in your survey
Summary | This article shows how to disable the cut, copy, paste and right-click functionalities on a page in your survey. |
to | AskiaDesign |
Written for | Survey programmers |
Keywords | Cut, Copy, Paste, Right-click, Disable, Text, Numeric, Box, Element, Label, JavaScript, jQuery, Code in cell, Code in control, ID, jquery.min.js, Body, Web survey. |
Download the example QES file here.
Firstly, ensure you have jquery.min.js added to your resources:
On the first page of the survey you will see how to disable individual elements by ID:
You need to insert a label and add script like that shown below - it's up to you which ids you use in the script but they need to be referred to in the elements you wish to disable.
On the second page you will see the example of how to disable cut, copy, paste & right-click functionalities on the whole page. You don't need to define or refer to any ids, simply place the script shown below in a label on the screen.
You will notice the cut, copy & paste functionalities are tied together in these examples. If you want to do one or some of them and allow others, e.g. only disable paste, you will need another solution. A method for only disabling the paste functionality is provided in this second example QEX file which can be downloaded here. It uses JavaScript and onpaste="return false;" applied in the 'Code in control' of elements you wish to disable paste for.