Welcome, Guest
Username: Password: Remember me

TOPIC: Prevent Copy/Paste into questions?

Prevent Copy/Paste into questions? 1 year 2 months ago #92742

  • LSCitizen
  • LSCitizen's Avatar
  • OFFLINE
  • Junior Lime
  • Posts: 33
  • Karma: 0
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? 1 year 2 months ago #92750

  • DenisChenu
  • DenisChenu's Avatar
  • OFFLINE
  • Moderator Lime
  • Posts: 5830
  • Thank you received: 711
  • Karma: 220
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
The administrator has disabled public write access.

Prevent Copy/Paste into questions? 1 year 2 months ago #92751

  • holch
  • holch's Avatar
  • OFFLINE
  • LimeSurvey Team
  • Posts: 2442
  • Thank you received: 254
  • Karma: 94
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 | Question Attributes | Workarounds

If you found this answer helpful and it saved you some time please consider a donation to the project to keep Limesurvey going!
The administrator has disabled public write access.
Moderators: ITEd
Time to create page: 0.106 seconds
Donation Image