Prevent pasting into custom textbox control.

  • Thread starter Thread starter AjitGoel
  • Start date Start date
A

AjitGoel

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\suggestions are highly appreciated.

Kind Regards;

Ajit Goel
 
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'ing" 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
 
Thanks Ray;

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