I have a textbox on a web form that I have the follow java code to enable a button only when the tilde key is entered. The problem I have is I cannot enter the \ or the ] keys without causing an error in the code logic. Here is the java code if (/^[a-zA-Z0-9- `!@#$%^&*()_+-={}|:"'?>|\[]*$/.test(str) == false) {. My second question is there a way to do this in the code behind?
Thanks in advance,
Kevin
ramya bharathPosted Apr 16, 2015, 1:46 PM
Kevin GilmorePosted Apr 16, 2015, 1:56 PM
Thanks,
Kevin GilmorePosted Apr 16, 2015, 1:37 PM
Thanks
ramya bharathPosted Apr 16, 2015, 12:57 PM
For matching special characters u can also use \ W representation
you can also regular expression validator to perform the same operation
In server code if you want to handle u can call server side code on change events but this is unnecessary as enabling a button is a simple step which doesn't need a server call