Jump to content

Block user from entering " or ' and other bad chars..


aximbigfan

Recommended Posts

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

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.