aximbigfan Posted March 7, 2008 Share Posted March 7, 2008 Hi, I know this is probably pretty easy stuff, but I am terrible coding JS. Basically, I have a text box. nothing fancy, <input type='text' yadda, yadda> I want to make sure that the user can't enter bad chars in this text box. I haven't figured out the extent of the the bad chars, but I already know that " ' are baaaddd. I do know that you generally want to validate on the server side, but I figure if the user is going to try and use some other way of posting, then the user probably wants to experiment and stuff. Which is fine, because this is a webapp (log viewer) and it is password protected anyway. I'll implement server side validation later. For now, I just want to do it with Js. What I would like it to do if the user enters a certain char in, is juts make a little alert() message saying that that char is invalid. Thanks, chris Quote Link to comment Share on other sites More sharing options...
Daniel0 Posted March 7, 2008 Share Posted March 7, 2008 Don't block it, but when outputting it use htmlentities() and make sure to escape the quotes before using the values in a query. Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.