473,883 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
+ 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 5643
On 2006-04-28 03:39:03 +0200, "khng" <kh********@gma il.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********@gma il.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
5352
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 program wants to write a new entry. This works OK, except that sometimes we want to copy out of piece of the contents and paste it in another window. When it's DISABLED, it appears that we can't even select a portion of the text. Is this an...
10
23554
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 VB, I can set keyascii=0 to kill the input. Is there a similar way to do it in JavaScript? Thanks a lot. <HTML><head></head><body> <form name="myForm"> Password: <input type="text"><br> Comfirm: <input type="text" name="myText"
3
4032
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
6691
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 functionality. I'd like to have the paste button disabled when the clipboard is empty, but I'm not sure how I should do this. Ideally, I suppose I'd like to constantly monitor the clipboard for data, (in a thread?) but I'm not even sure how I'd...
3
2888
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 application or notepad where i want to paste it to be.How can i do it?If anyone knows source code or any website URL's please let me know. Umasakshi
9
10299
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 like to either disable or find a work around for. Background: I have a form that has 3 input type="text" fields. The fields are Quantity, Amount and total. OnKeyUp is used when you enter something in Quantity or Amount to trigger a javaScript...
4
4479
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 right mouse buttons simultaneously. The code to handle the drag and drop is already complicated enough without taking this scenario into account. Is it possible to completely disable the right mouse button when this particular form is loaded? Any...
0
1711
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) { event.returnValue = false; } }
0
9943
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, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9793
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
11151
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10750
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9577
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7974
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
7134
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 then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5804
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 last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4619
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 we have to send another system

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.