Prevent pasting into custom textbox control.

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
 
R

Ray Costanzo

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
 
A

AjitGoel

Thanks Ray;

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

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,764
Messages
2,569,564
Members
45,039
Latest member
CasimiraVa

Latest Threads

Top