Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

preventing copy and paste in a text box

Status
Not open for further replies.

stemitch2000

Programmer
Nov 12, 2003
47
0
0
GB
Hello people,

Please can you help me? I have a text box, but do not wish the user to be able to paste into the text box. They are allowed to write in it - but not paste into it. Anyone know how I go about doing this? I suppose I could see if the first key pressed is a ctrl, but is there a simplier way.

Thank you
 
nope, even trapping ctrl key wont do as the user can always right click and paste...

Known is handfull, Unknown is worldfull
 
I believe the only way to prevent the user from pasting into a text box would be to make the box readonly. This would, however, also prevent the user from typing anything into the box, as well.

------------------------------------------------------------------------------------------------------------------------
"The major difference between a thing that might go wrong and a thing that cannot possibly go wrong is that when a thing that cannot possibly go wrong goes wrong it usually turns out to be impossible to get at or repair."
--Dou
 
uhm, check with the javascript forum, as i remember there's abilities in javascript to copy/paste from within script and in turn i would assume it's possible to trap these events in reverse to prevent them
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top