SitePoint Sponsor

User Tag List

Results 1 to 11 of 11
  1. #1
    SitePoint Zealot
    Join Date
    Dec 2001
    Posts
    198
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    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

  2. #2
    Guru Bullschmidt's Avatar
    Join Date
    Apr 2002
    Location
    USA
    Posts
    524
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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
    J. Paul Schmidt
    www.Bullschmidt.com - Freelance Web and Database Developer
    www.Bullschmidt.com/DevTip.asp - Classic ASP Design Tips

  3. #3
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  4. #4
    SitePoint Enthusiast
    Join Date
    Apr 2002
    Posts
    54
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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 .

  5. #5
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  6. #6
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    just about all events that don't look normal probably aren't. IE has many that don't work in other browsers
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  7. #7
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    hehe how about

    onMaelstrom="alert('')"

  8. #8
    SitePoint Wizard
    Join Date
    Oct 2001
    Location
    Tucson, Arizona
    Posts
    1,858
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Question

    Did I mention that I hate this kind of "disabling the user" stuff?

  9. #9
    Currently Occupied; Till Sunda Andrew-J2000's Avatar
    Join Date
    Aug 2001
    Location
    London
    Posts
    2,475
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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

  10. #10
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can help.

  11. #11
    SitePoint Member
    Join Date
    May 2002
    Posts
    7
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    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.


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •