Search
 
SCRIPT & CODE EXAMPLE
 

JAVASCRIPT

how to validate multiple input field in javascript

<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
{function validateForm()

var x=document.forms["myForm"]["name"].value;
if (x==null || x=="")
  {
  alert("Name must be filled out");
  return false;
  }

var y=document.forms["myForm"]["password"].value;
  {
if (y==null || y=="")
  alert("Password name must be filled out");
  return false;
  }
</script>
</head>

<body>

<form name="myForm" action="demo_form.asp" onsubmit="return validateForm()" method="post">
Name*: <input type="text" name="name"> <br>
Password*: <input type="password" name="password"><br>
Email: <input type="text" name="email"><br>
<input type="submit" value="Submit">
</form>
</body>

</html>
Comment

PREVIOUS NEXT
Code Example
Javascript :: javasript array 
Javascript :: javascript alarm 
Javascript :: event solidity 
Javascript :: comment field react 
Javascript :: nodejs convert string to date 
Javascript :: jquery search string for substring 
Javascript :: find all the prime numbers in the array 
Javascript :: nextjs apollo client 
Javascript :: react upload image 
Javascript :: ajax post request 
Javascript :: creating the find method javascript 
Javascript :: createReadStream axios 
Javascript :: EFSavechanges 
Javascript :: API key header for appsync graphql request 
Javascript :: JavaScript for loop Display a Text Five Times 
Javascript :: javascript Update Values of Properties 
Javascript :: JavaScript WeakMap Methods 
Javascript :: javascript Duplicating a parameter name is not allowed 
Javascript :: React.jsx: type is invalid -- expected a string (for built-in components) or a class/function (for composite components) but got: object. 
Javascript :: jQuery Traversing - Descendants 
Javascript :: bootstrap on tabs change 
Javascript :: get page scrolling amount js 
Javascript :: phaser place on part of circle 
Javascript :: phaser play animation with config.js 
Javascript :: core.mjs:4057 JIT compilation failed for NgModule class AppModule 
Javascript :: react native bootsplash generate splash 
Javascript :: how to get params from function js 
Javascript :: how to put multiple conditions in if statement node .js 
Javascript :: forms in angular 
Javascript :: regex and 
ADD CONTENT
Topic
Content
Source link
Name
3+6 =