Prevent pasting into custom textbox control.

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • AjitGoel

    Prevent pasting into custom textbox control.

    Hi;

    I need to create a custom textbox control which will not allow a user
    to paste text from the clipboard. The user has to always type the text
    into the textbox.

    I tried searching on the internet since I guessed someone would have
    faced this problem before but of no avail. Do we have pointers on how
    I should go about doing this??

    Comments\sugges tions are highly appreciated.

    Kind Regards;

    Ajit Goel

  • Ray Costanzo

    #2
    Re: Prevent pasting into custom textbox control.

    I can't imagine why you'd want to do this, and it's pretty much not possible
    to prevent someone completely from entering data into a textbox the way he
    seems fit. In addition to pasting, will you try to prevent the person from
    dragging text in? If you capture Ctrl+V with javascript, will you also
    capture keyboard buttons that paste without just "sendkey'in g" Ctrl+V? What
    about when someone uses something like Roboform to fill the field? Will you
    also prevent a right-click so the person can't choose to paste from the
    context menu?

    I suggest that you eliminate this requirement if at all possible. To put
    together a perfect solution is impossible. To put together one that is
    close to perfect would be a lot of code to maintain for something very
    silly.

    Ray at work

    "AjitGoel" <ajitgoel@gmail .comwrote in message
    news:1176832907 .081125.127440@ d57g2000hsg.goo glegroups.com.. .
    Hi;
    >
    I need to create a custom textbox control which will not allow a user
    to paste text from the clipboard. The user has to always type the text
    into the textbox.
    >
    I tried searching on the internet since I guessed someone would have
    faced this problem before but of no avail. Do we have pointers on how
    I should go about doing this??
    >
    Comments\sugges tions are highly appreciated.
    >
    Kind Regards;
    >
    Ajit Goel
    >

    Comment

    • AjitGoel

      #3
      Re: Prevent pasting into custom textbox control.

      Thanks Ray;

      I appreciate your input. I guess this thought came in when the BA and
      my director told me to explore this option.

      On Apr 17, 1:52 pm, "Ray Costanzo" <my first name at lane 34 dot
      commercialwrote :
      I can't imagine why you'd want to do this, and it's pretty much not possible
      to prevent someone completely from entering data into a textbox the way he
      seems fit. In addition to pasting, will you try to prevent the person from
      dragging text in? If you capture Ctrl+V with javascript, will you also
      capture keyboard buttons that paste without just "sendkey'in g" Ctrl+V? What
      about when someone uses something like Roboform to fill the field? Will you
      also prevent a right-click so the person can't choose to paste from the
      context menu?
      >
      I suggest that you eliminate this requirement if at all possible. To put
      together a perfect solution is impossible. To put together one that is
      close to perfect would be a lot of code to maintain for something very
      silly.
      >
      Ray at work
      >
      "AjitGoel" <ajitg...@gmail .comwrote in message
      >
      news:1176832907 .081125.127440@ d57g2000hsg.goo glegroups.com.. .
      >
      >
      >
      Hi;
      >
      I need to create a custom textbox control which will not allow a user
      to paste text from the clipboard. The user has to always type the text
      into the textbox.
      >
      I tried searching on the internet since I guessed someone would have
      faced this problem before but of no avail. Do we have pointers on how
      I should go about doing this??
      >
      Comments\sugges tions are highly appreciated.
      >
      Kind Regards;
      >
      Ajit Goel- Hide quoted text -
      >
      - Show quoted text -

      Comment

      Working...