Expand my Community achievements bar.

SOLVED

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

Avatar

Level 2

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

1 Accepted Solution

Avatar

Correct answer by
Level 10

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 = "";


}


View solution in original post

5 Replies

Avatar

Level 10

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 = "";

}

Avatar

Level 2

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

Avatar

Correct answer by
Level 10

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 = "";


}


Avatar

Level 2

Hey radzmar,

I'd be grateful if you could look in the below thread and provide a solution. I see you have answered a few questions there.

Re: How to force alpha or numeric inside text fields - LiveCycle Designer 9.0

Thanks,

Radhika