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

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • 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.