SitePoint Sponsor

User Tag List

Results 1 to 3 of 3
  1. #1
    SitePoint Enthusiast
    Join Date
    Aug 2002
    Location
    Israel, Tel Aviv
    Posts
    31
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Disabling/Blocking paste function by keyboard+mouse in form field.

    Can you help to build a javascript that will block any paste function by keyboard and mouse in form field.

    I know it something like onPaste="return flase;" but it work only with keyboard but what about mouse blocking ?

    Thanks
    Last edited by Shinza; Dec 14, 2002 at 10:34.

  2. #2
    We like music. weirdbeardmt's Avatar
    Join Date
    May 2001
    Location
    Channel Islands Girth: Footlong
    Posts
    5,882
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Well it is possible to catch the right click of a mouse, but I don't know (I don't see why not) if you could limit that just to an input box.
    I swear to drunk I'm not God.
    Matt's debating is not a crime
    Hint: Don't buy a stupid dwarf Clicky

  3. #3
    SitePoint Member dotjeff's Avatar
    Join Date
    Dec 2002
    Location
    Oregon
    Posts
    12
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: Disabling/Blocking paste function by keyboard+mouse in form field.

    Shinza,

    Originally posted by Shinza
    Can you help to build a javascript that will block any paste function by keyboard and mouse in form field.

    I know it something like onPaste="return flase;" but it work only with keyboard but what about mouse blocking ?
    It's "onpaste" (note the case) and "return false" (note the corrected spelling of false), but that's only one tiny part of the puzzle.

    You're really going down the wrong road. Without knowing the purpose behind your question, however, it's difficult to offer an alternative. Assuming all you really want to do is to stop a paste operation, how about just not using a form element? That's gotta be a far easier solution than trying to limit paste functionality.

    Give some more background to what you're trying to do and why and I'm sure a better solution can be found than preventing the user from pasting.

    Thanks,

    Jeff


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
  •