Meaningless Drivel is fun!*
The moose likes HTML, CSS and JavaScript and the fly likes Disable mouse selections in JSP Input Field Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "Disable mouse selections in JSP Input Field" Watch "Disable mouse selections in JSP Input Field" New topic
Author

Disable mouse selections in JSP Input Field

Nitin Sinha
Greenhorn

Joined: May 08, 2008
Posts: 17
I have a JSP Page in which I have 2 input fields -
First one for entering email address and second one for Re-Entering email address.

Now, my query is that i don't want user to cut / copy email address from one box and paste it onto another box. For this I have used JavaScript to clock ctrl+X,V,C and right clicks etc..

But my question is that is there a way to disable Cut & Paste options from browsers 'EDIT' Menu.

If not then how can i block mouse selection from Input fields, that is disallow users to select what they typed in Input Box.
Ben Souther
Sheriff

Joined: Dec 11, 2004
Posts: 13410

There is no such thing as a JSP input field.

I'll move this to our HTML/Javascript forum where you'll get better help with client side coding issues.


Java API J2EE API Servlet Spec JSP Spec How to ask a question... Simple Servlet Examples jsonf
Eric Pascarello
author
Rancher

Joined: Nov 08, 2001
Posts: 15376
    
    6
There is really no real way to do it. Most companies do not bother to block it.

You can look into oncopy and onpaste, but they are not widely supported.

Eric
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: Disable mouse selections in JSP Input Field
 
Similar Threads
Disabling short cut keys
Copy and Paste from EXCEL to HTML Text Input
Retrict copy from a text field
credential management
How to disable the right click button in Textfield o HTML form with NN4