[RESOLVED] User input msg validation
Hi guys :wave:
I have setup a jQuery way to submit messages by the users. And it works fine. But I want to include a clientside validation on the "msg" being submitted by the user (already coded server side validation).
What I want to validate is, it shouldn't contain any HTML tags or scripts or anything harmful.
Any ideas or code bits ?
Note: I'm very much new to jQuery :)
:wave:
Re: User input msg validation
Did you ever get an answer to your problem?
Re: User input msg validation
I found that, there's some premade plugins for jQuery to do the validations. But didn't checked those.
I'm just using the test() method to validate using regex.
Code:
var regex=/^[a-zA-Z]$/;
if(!regex.test($('#username')))
{
//failed. show an error and return
return
}
:wave:
Re: User input msg validation
Maybe you could do something with John Resig's HTML Parser to check for any HTML in the text?
Re: User input msg validation