File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
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

Disable mouse selections in JSP Input Field

Nitin Sinha

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

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

Joined: Nov 08, 2001
Posts: 15385
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.

I agree. Here's the link:
subject: Disable mouse selections in JSP Input Field
It's not a secret anymore!