I am trying to call a function inside another function but its not working.
P.S i am a beginnner in JS
<script type="text/javascript">
<!--
// Form validation code will come here.
function validate() {
madatorychk(name);
//This functions makes sure that madatory fields are filled
function madatorychk(fieldid) {
var node = document.myForm.fieldid;
if (node.value == "") {
alert("This field cannot be left empty");
document.myForm.fieldid.focus();
return false;
}
}
}
//-->
</script>
<form method="get" onsubmit="return(validate());" name="myForm">
<label>Name: <input type="text" id="name"></label> </form>
</form>