In this Tutorial, we are going to learn how to protect our form from unexpected or inappropriate words from the outside client or users.
Some times users fill some bed words into the form. So here we want to filter and eliminate these inappropriate word so that we can get the right data from client side.

In this Example:-

1). We are using HTML for Building Form

2). JavaScript for Validation

In this form we are using one Textarea field for getting input from client side. but before submitting the form we are checking validation for this and then showing popup alert when validation find any bed word into the Textarea field that we describe into the bed word array. Validate form from the bed word.

<form action="thankyou.htm" method="post" name="form" onsubmit="return Messages();">

     <textarea name="textbox" style="border: 1px #555 solid; font-size: 14px; height: 60px; width: 250px;"></textarea>
     <input type="submit" value="Send" />
</form>
After building the form Copy and paste the below code before the Head Tag. JavaScript code should be in the proper Script  Tags like displayed into the below code.

After validation, form action tag will redirect you to the given page.

Thanks
If you have any query regarding Blogging or adsense then you are welcome. just contact me from the contact form. we will try to response you as quickly as possible.
Validate form from the bed word.

You Might Also Read : -

0 comments :

Post a Comment

 
# Top