Your achievements

Level 1

0% to

Level 2

Tip /
Sign in

Sign in to Community

to gain points, level up, and earn exciting badges like the new
BedrockMission!

Learn more

View all

Sign in to view all badges

SOLVED

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

Radhika_Magaji
Level 2
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
radzmar
Correct answer by
Level 10
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
radzmar
Level 10
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 = "";

}

Radhika_Magaji
Level 2
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

radzmar
Correct answer by
Level 10
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

Radhika_Magaji
Level 2
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