Check out the LimeSurvey source code on GitHub!
Welcome, Guest
Username: Password:

TOPIC: Prevent Copy/Paste into questions?

Prevent Copy/Paste into questions? 3 years 9 months ago #92742

  • LSCitizen
  • LSCitizen's Avatar
  • Offline
  • Junior Lime
  • Posts: 38
  • Thank you received: 1
  • Karma: 1
Hello -
Is there a way to prevent users from copying and pasting values into Short Free Text, Numerical Input and DatePicker questions?

Thanks..
The administrator has disabled public write access.

Prevent Copy/Paste into questions? 3 years 9 months ago #92750

  • DenisChenu
  • DenisChenu's Avatar
  • Offline
  • Moderator Lime
  • Posts: 9600
  • Thank you received: 1376
  • Karma: 390
Not tested,

But someting like this:
$(document).ready(function()
{
    var ctrlDown = false;
    var ctrlKey = 17, vKey = 86, cKey = 67;
 
    $(document).keydown(function(e)
    {
        if (e.keyCode == ctrlKey) ctrlDown = true;
    }).keyup(function(e)
    {
        if (e.keyCode == ctrlKey) ctrlDown = false;
    });
 
    $(":text,textarea").keydown(function(e)
    {
        if (ctrlDown && (e.keyCode == vKey || e.keyCode == cKey)) return false;
    });
})
Source : stackoverflow.com/a/2904944

Denis
Assistance on LimeSurvey forum and LimeSurvey core development are on my free time.
I'm not a LimeSurvey GmbH member, professional service on demand (use private message).
The administrator has disabled public write access.

Prevent Copy/Paste into questions? 3 years 9 months ago #92751

  • holch
  • holch's Avatar
  • Offline
  • LimeSurvey Team
  • Posts: 5446
  • Thank you received: 814
  • Karma: 240
That would annoy me like hell. A website (which a online survey is somehow), shouldn't want to play around with my browser or desktop.

First thing would be to switch of JavaScript and do it anyway.
Have a look at the manual! It is a really valuable source for information. Here some helpful links:
Manual (EN) | Question Types | [url=https://manual.limesurvey.org/Workarounds[/url]

If you found this answer helpful and it saved you some time please consider a [url=https://donate.limesurvey.org[/url] to the...
The administrator has disabled public write access.
Time to create page: 0.208 seconds
Imprint                   Privacy policy         General Terms & Conditions         Revocation information and revocation form