I am new to this technology, I had created rules.js file in which i mentioned validate function which is used for required field validator for textarea. but after adding the js file in my html page i unable to call the function please let me know what i am doing wrong.
rules.js file
Code: Select all
<script>
function validate()
{
var req=document.forms["registration"]["comments"].value;
if (req==null || req=="")
{
alert("");
return false;
}
}
</script>
Code: Select all
<script type="text/javascript" src="rules.js"></script>
Form tag
Code: Select all
<form id="registration" name="registration" method="POST" action="" onsubmit="return validate();">