Restrict users from cutting and pasting content(form data) in form fields

Radhika_Magaji

04-03-2015

Hi,

I have a requirement where there are two fields: "Enter Email Address" and "Re-enter Email Address". The form should not allow the user to cut-and-paste the Email Address into the Re-enter field. It must be manually entered. Can this be done through javascript? Or by setting form properties with LiveCycle Designer? I'm using Es4 version. I am aware that i can restirct user from copying content within form. Solution to retrict pasting will be highly appreciated.

Thanks in advance,

Radhika

Accepted Solutions (1)

Accepted Solutions (1)

radzmar

MVP

04-05-2015

Hi,

you can check if the Ctrl-Button is pressed while the new value is entered in a field.

So you can at least avoid pasing through Ctrl + V key combination.


if (xfa.event.change.length > 1 || xfa.event.modifier === true ) {


    xfa.event.change = "";


}


Answers (4)

Answers (4)

radzmar

MVP

05-03-2015

You can add a JavaScript script in the change event to check how long the inserted value is.

When users types in the value it will be 1 but when the value is pasted it will be longer.

if (xfa.event.change.length > 1) {

     xfa.event.change = "";

}

Radhika_Magaji

29-04-2015

Hi radzmar,

This works perfectly fine as long as the field is an email address.

But in other case, if i have "Text Field1" rawvalue to have 1 character entered, it wil still copy that 1 character to other field.

Can we restrict user from copying the value itself so that he has no way to paste it at all?

Thanks,

Radhika