473,473 Members | 1,959 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Disable Paste and Drag event

How to disable the copy/drag event for some selected textfield as I
want the user to key in instead of copy or drag the required
information.

For IE, I done it with the onPaste and onDragEnter Event, but it don't
work on Other Browser, so I need your helping hand

Apr 28 '06 #1
2 5599
On 2006-04-28 03:39:03 +0200, "khng" <kh********@gmail.com> said:
How to disable the copy/drag event for some selected textfield as I
want the user to key in instead of copy or drag the required
information.


You can't disable copy/paste. So you'll have to implement that another way.

You can do it by watching keypress and onchange events.

If the value of your input element changes without enough keys having
been pressed, you'll know some characters weren't typed. For example,
with an onkeypress event handler, you could increment a counter
(decrement it for delete key, don't change for arrow keys, etc). Inside
an onchange handler, compare that counter with how many characters were
added to the value since the last onchange. If the number seems
reasonable (don't be too strict though, if only 5 keys were pressed to
input a 7-char-long string, maybe some events were just skipped or
something...), then these chars were probably typed in the hard way.

This rough method will also block auto-completing forms, and maybe some
voice recognition software as well.

I'm curious, why do you want your users to forsake the wondrous
facilities offered by their OS and endanger their precious wrists ?
--
David Junger

Apr 30 '06 #2

Touffy wrote:
On 2006-04-28 03:39:03 +0200, "khng" <kh********@gmail.com> said:
How to disable the copy/drag event for some selected textfield as I
want the user to key in instead of copy or drag the required
information.


You can't disable copy/paste. So you'll have to implement that another way.

You can do it by watching keypress and onchange events.

If the value of your input element changes without enough keys having
been pressed, you'll know some characters weren't typed. For example,
with an onkeypress event handler, you could increment a counter
(decrement it for delete key, don't change for arrow keys, etc). Inside
an onchange handler, compare that counter with how many characters were
added to the value since the last onchange. If the number seems
reasonable (don't be too strict though, if only 5 keys were pressed to
input a 7-char-long string, maybe some events were just skipped or
something...), then these chars were probably typed in the hard way.

This rough method will also block auto-completing forms, and maybe some
voice recognition software as well.

I'm curious, why do you want your users to forsake the wondrous
facilities offered by their OS and endanger their precious wrists ?
--
David Junger


Thanks you your suggestion...

But for some field, e.g.the email field I want the user to type it
manually instead of copy or drag

May 2 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: Patrick L. Nolan | last post by:
Our Tkinter application has a big ScrolledText widget which is a log of everything that happens. In order to prevent people from making changes, we have it in DISABLED mode except when the...
10
by: chirs | last post by:
I have a code to disable ctrl-v (paste) on the 2nd box. The problem is that when I type ctrl-v, the text shows, then disappear after I release ctrl-v. How can I make it not to show in the box. In...
3
by: Sumit | last post by:
Hi all, Is there any way to disable copy & paste options using ctrl + Insert & Shift + Insert respectively on Windows forms using C#. Kindly Help !! Regards Sumit Vohra
3
by: Stilgar[bbs.isca.uiowa.edu] | last post by:
Here's my newbie question: I have several VB forms which are all inherit a standard template form that I made. In my template form, I added a menu bar with some generic cut, copy, and paste...
3
by: Uma sakshi | last post by:
Hi I have one VB.NET application,in that application i have one datagrid control.The datagrid control contains somedata.I want to copy the data in a particular cell and paste it into my C#.NET...
9
by: surf_doggie | last post by:
Im not sure if this is the group to post in, if anyone knows a more appropriate one please let me know. Please consider the following example of a feature most all browsers have that I would...
4
by: Vincent | last post by:
I have created a drag and drop scheduler within Microsoft access. One of our bug testers was doing some testing and noticed that the drag and drop gets messed up if they press both the left and...
0
by: kavi2012 | last post by:
Hi I used the following function to disable the cut, Copy & paste in the Textbox. It works fine for me when I use ctrl+C,ctrl+X & ctrl+V. function disable(e) { if(event.ctrlKey) { ...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...
1
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.