Detecting past into textarea

H

Holden Caulfield

Does anyone know how to detect if a user has pasted code using the
right mouse button into a textarea?

I have fields in a form that autoupdate when text is changed in a
textarea, but if it is pasted using the mouse (not CTRL-V) the trigger
doesn't happen.

I tried onChange first, no luck. Detecting keystrokes and LEFT
mouseclicks was easy enough, and it works for those. But SOME users
paste stuff in without ever typing or left-clicking and it is messing
everything up.

Thanks,
Holden
PS: I think I may have to go into the murky world of right-click
detection (sorting through dozens of crappy reputed "source code
protectors") unless someone can give me a lead (or even better the
needed event handler!)
PPS: To make matters worse, it needs to work with IE 5 and up.
(Intranet)

Thanks,
Holden
 
R

Richard Cornford

... . But SOME users paste stuff in without ever
typing or left-clicking and it is messing
PPS: To make matters worse, it needs to work
with IE 5 and up. (Intranet)

That doesn't make it worse it makes it easier as IE 5 textarea elements
support:-

onbeforepaste
onpaste

- which should suite you task.

(but doesn't IE allow you to drag and drop text into a textarea? I don't
recall whether that counts as a paste.)

Richard.
 
R

Richard Formby

Richard Cornford said:
That doesn't make it worse it makes it easier as IE 5 textarea elements
support:-

onbeforepaste
onpaste

- which should suite you task.

(but doesn't IE allow you to drag and drop text into a textarea? I don't
recall whether that counts as a paste.)

ondrop fires.
 
H

Holden Caulfield

Thanks Richard and Richard,
I will give those a try.

Much appreciated,

Holden
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,266
Messages
2,571,083
Members
48,773
Latest member
Kaybee

Latest Threads

Top