JavaScript Form Validation

  In this form validation used for blank system method, its not allow for without form filling.if user not type for employee name its not  allow for submit section.


<script type = "text/javascript">
      function formvalidation() {
         if( document.myform.ename.value == "" ) {
            alert( "Please Enter your name!" );
            document.myform.ename.focus() ;
            return false;
		  if( document.myform.designation.value == "" ) {
            alert( "Please Enter your Designation!" );
            document.myform.designation.focus() ;
            return false;
		 return( true );
<div style="margin-left:300px;">
<h2>Employee Details:</h2>
<form name = "myform" onsubmit = "return(formvalidation());">
Name :<input type = "text" name = "ename" ><br><br>
Designation :<input type = "text" name = "designation" ><br><br>
<input type = "submit" value = "Submit">



We hope, you all are like this topic.if you have any query,please drop me your comment below comment box section,we are reply to you as soon as possible.

Add a Comment

Your email address will not be published. Required fields are marked *