SitePoint Zealot
preventing the pasting of text in forms
situation : I have a website where users can make their own profile pages and this includes a guestbook. Now some of those users past pretyped messages in all those guestbooks to get some extra attention. This is becoming slightly annoying so I want to add something so that they really have to type their message instead of pasting it.
I dont know exactly what language I would need or how I should solve this, so every suggestion is welcome
Well this could at least help prevent those who paste by right-clicking:
No right mouse click script III (no alert) by Renigade (renigade@mediaone.net)
http://www.dynamicdrive.com/dynamicindex9/noright3.htm
Disable right mouse click script by Crash @ http://walk.to/crash
http://www.dynamicdrive.com/dynamicindex11/noright.htm
use this
<div onbeforepaste="document.body.focus()"><textarea>adfhadfh</textarea></div>
it will be the best method for canceling paste
theres also these tags which you might want to take into concederation
onbforecut=""
onbforecopy=""
onbforepaste=""
oncut=""
oncopy=""
onpaste=""
hope that helps better than disabling right click, which disables much more functionality
SitePoint Enthusiast
These onbeforepaste/onbeforecut/... events; in which browsers do they work in? Are they IE5 (or 5.5) extensions perhaps? I guess it doesn't really matter much if they are, as you're blocking out 90pc+ of browsers from pasting anyway .
heres all the event methods, some might be outta date
onabort = netscape 3, 4 - 4.7++, ie 4,5,5.5++
onafterprint = ie 5,5.5++
onafterupdate = ie 4,5,5.5++
onbeforecopy = ie 5,5.5++
onbeforecut = ie 5,5.5++
onbeforepaste = ie 5,5.5++
onbeforeprint = ie 5,5.5++
onbeforeunload= ie5,5.5++
onbeforeupate = ie 4,5,5.5++
onbounce = ie 4,5,5.5++
oncopy = ie 4,5,5.5++
oncut = ie 5,5.5++
ondataavailable=ie 4,5,5.5++
ondatasetchanged=ie 4,5,5.5++
ondatasetcomplete=ie 4,5,5.5++
ondragdrop = netscape 4 - 4.7++
ondragstart = ie 4,5,5.5++
onerror = netscape 4 - 4.7++, ie 4,5,5.5++
onerrorupdate = ie 4,5,5.5++
onfilterchange = ie 4,5,5.5++
onfinish = ie 4,5,5.5++
onhelp = ie 4,5,5.5++
onmove = netscape 4 - 4.7++
onpaste = ie 5,5.5++
onreadystatechange=ie 4,5,5.5++
onresize = netscape 4 - 4.7++, ie 4,5,5.5++
onrowenter = ie 4,5,5.5++
onrowexitr = ie 4,5,5.5++
onscroll = ie 4,5,5.5++
onselectstart = ie 4,5,5.5++
onstart = ie 4,5,5.5++
and i dont think i will be typing that out again lol
just about all events that don't look normal probably aren't. IE has many that don't work in other browsers
hehe how about
onMaelstrom="alert('')"
Did I mention that I hate this kind of "disabling the user" stuff?
Don't we all, no point moaning anymore, for every new web developer a similar question will come along like this.
Is there a complete quide to usability on sitepoint, coz that way every one ouldn't have to answer these usability problems
Originally posted by Andrew-J2000
Don't we all, no point moaning anymore, for every new web developer a similar question will come along like this.
Is there a complete quide to usability on sitepoint, coz that way every one ouldn't have to answer these usability problems
Some people have legit uses for disabling right click. And it is a good way to learn the error of there ways.
How about writing a function that strips all tags of that is if the textarea is a plain one and not the html versions.
Even if it's an html enhanced field only allow certain tags can still be accomplished.
Posting Permissions
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts
Forum Rules
Bookmarks