wood burning stoves 2.0*
The moose likes GWT and the fly likes Disable Copy/Paste in a Textbox Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Murach's Java Servlets and JSP this week in the Servlets forum!
JavaRanch » Java Forums » Frameworks » GWT
Bookmark "Disable Copy/Paste in a Textbox" Watch "Disable Copy/Paste in a Textbox" New topic
Author

Disable Copy/Paste in a Textbox

Nilesh Pat
Ranch Hand

Joined: Mar 01, 2010
Posts: 46

i want to Disable Copy/Paste in a Textbox in GWT.
as i am using password field and confirm password filed. User should not able to copy string from password filed to confirm password filed.

i am using PasswordTextBox for password filed.

i also want to do same for user id n confirm user id which are normal text boxes.


Regards,
Nil
Nilesh Pat
Ranch Hand

Joined: Mar 01, 2010
Posts: 46
hey... password text box itself provides functionality to block copy from it.
but you can paste in it... so that's ok.

but the problem exists for normal text box. at least i should able to block paste in confirm text box.
Nilesh Pat
Ranch Hand

Joined: Mar 01, 2010
Posts: 46

hey i got the solution.
first write
sinkEvents( Event.ONPASTE );
in the constructor.

then write

Maneesh Godbole
Saloon Keeper

Joined: Jul 26, 2007
Posts: 10167
    
    8

Well done
Thank you for sharing your solution.

PS. I edited your previous post to incorporate code tags. In future, while posting code, please UseCodeTags As you can see, code tags makes the post easier to read and easier to understand.


[How to ask questions] [Donate a pint, save a life!] [Onff-turn it on!]
Nilesh Pat
Ranch Hand

Joined: Mar 01, 2010
Posts: 46
hey maneesh thank you..

actually i was also searching for that UseCodeTags but could't find it. so just posed it..
but thank you for your editing.
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
 
subject: Disable Copy/Paste in a Textbox
 
Similar Threads
how to do copy/paste using swing
javascript:Restricting the user to paste in textbox
Disabling copy and paste option in h:inputText and h:inputSecret
How to disable the right click button in Textfield o HTML form with NN4
Copy-to-clipboard