Have an idea?

Visit Sawtooth Software Feedback to share your ideas on how we can improve our products.

Disabling copying and pasting within a survey

Hi there, I've seen this issue come up in the past and my recollection is there wasn't any wonderful solutions. Or is there?

Are there any easy methods to apply to prevent copying / pasting of confidential material that is displayed within a survey?

Or is there methods to make it more difficult?

Looking forward a to your reply.

Thank you.
asked Aug 16, 2017 by Paul Moon Platinum (100,815 points)

1 Answer

0 votes
Hey Paul,

Please try the below code for your requirement :


<script type="text/javascript">

$(document).ready(function(){
  $('.numeric_input').live("cut copy paste",function(e) {
    e.preventDefault();
  });
});

$(".numeric_input").on("contextmenu",function(e){
            return false; /*right click disable*/
    });
</script>


The above code will function for disabling the copy paste and also i have provided the right click disabling which can avoid pasting through mouse  clicks


Place the above in footer and based on the question please the class, as now i have provided the code for "numeric_input"
answered Aug 16, 2017 by sandeepkapalawai Bronze (1,455 points)
I could be placing this on a text or O/E question. Do you have the script for such questions. I will report back to you once I test it. Thanks.
if your placing this for open end just use open end class(open_end_text_box)

<script type="text/javascript">
 
$(document).ready(function(){
  $('.open_end_text_box').live("cut copy paste",function(e) {
    e.preventDefault();
  });
});
 
$(".open_end_text_box").on("contextmenu",function(e){
            return false; /*right click disable*/
    });
</script>
Thanks. I will test this soon and report back.
sure paul
Hi Sandeep.

I popped this script into the footer of my O/E question. My O/E question contains multiple rows.

When testing, I was able to right click the mouse and print screen? Have I missed something?
Hey Paul,

I just check it by creating Open end with multiple open ends in a single and its working fine for light house 9 too.

Let me know if you still encounter the same.

May i know how you are creating open end with multiple lines .i have done using grid questions , based on question the class will be  ".open_end_text_box" so i have used the same for the above code.

Fyi, i have tried this in 8.4.8 version and i hope it works for
I tried it in v9 Lighthouse Studio.

I tried it in a standard O/E question, not a grid.

Not sure why it is not working?
Even if you try in normal open ended question it should work.

Can you please check the class by right clicking on inspect element and let me know what class you would be able to see it
Looks like ...

<div class="question openend" id="Q1a_div">
Hi Paul,

In that case the class  "question openend" should be replaced with the code what i have gave you .

<script type="text/javascript">
  
$(document).ready(function(){
  $('.question openend).live("cut copy paste",function(e) {
    e.preventDefault();
  });
});
  
$(".question openend").on("contextmenu",function(e){
            return false; /*right click disable*/
    });
</script>


It looks like that classes from 8.4.8 vary from light house
I tried this the moment I looked up the class and still had issues?

I'll double check the script is pasted in correctly tomorrow and report back to this post.

But no success yet?
extremely sorry the code which i have sent you above has some typos

plz find the below one :


<script type="text/javascript">
   
$(document).ready(function(){
  $(".question openend").live("cut copy paste",function(e) {
    e.preventDefault();
  });
});
   
$(".question openend").on("contextmenu",function(e){
            return false; /*right click disable*/
    });
</script>


Also i suggest you to check the class again as far i know there will not a be space for the words like which you have sent in the above comment as  <div class="question openend" >
...