Click to See Complete Forum and Search --> : onPaste event


aish
09-09-2005, 01:23 AM
I want to validate asp.net textboxes,it should not allow to enter invalid characters,I used for javascript keycode to validate key code, and I call this javascript in codebehind page like this,

txtFirstName.Attributes.Add("onkeypress","return AlphaOnly();");

but my problem is when I copy and Paste these invalid characters to textbox it did not fire error message. then I used OnPaste and lostfocus event like this but it's not working,

txtFirstName.Attributes.Add("onPaste","return AlphaOnly();");

what can I do for this?
Thanks.

Cstick
09-09-2005, 10:00 PM
It looks like you are adding the event and method name properly. It seems likely that your JS has errors and that is why you aren't seeing the message. If you are using Firefox then you should have a javascript console, that is very helpfull with debugging JS.