Prevent Copy/Paste into questions?

More
4 years 2 months ago #92742 by LSCitizen
LSCitizen created the topic: Prevent Copy/Paste into questions?
Hello -
Is there a way to prevent users from copying and pasting values into Short Free Text, Numerical Input and DatePicker questions?

Thanks..

Please Log in to join the conversation.

More
4 years 2 months ago #92750 by DenisChenu
DenisChenu replied the topic: Prevent Copy/Paste into questions?
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 (or search sondages pro).
An error happen ? Before make a new topic : remind the Debug mode .

Please Log in to join the conversation.

More
4 years 2 months ago #92751 by holch
holch replied the topic: Prevent Copy/Paste into questions?
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.

I'm not a LimeSurvey GmbH member. I answer at the LimeSurvey forum in my spare time. No support via private message.
Some helpful links: Manual (EN) | Question Types | Workarounds

Please Log in to join the conversation.

Start now!

Just create your account and start using Limesurvey today.

Register now