JAVA SCRIPT REGISTRATION FORM VALIDALION
1. INDEX .HTML
<!-- Data Validation
Data validation is the process of ensuring that user input is clean, correct, and useful.
Typical validation tasks are:
has the user filled in all required fields?
has the user entered a valid date?
has the user entered text in a numeric field?
Most often, the purpose of data validation is to ensure correct user input.
Validation can be defined by many different methods, and deployed in many different ways.
Server side validation is performed by a web server, after input has been sent to the server.
Client side validation is performed by a web browser, before input is sent to a web server. -->
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta http-equiv="X-UA-Compatible" content="ie=edge">
<title>JavaScript Form Validation</title>
<link rel="stylesheet" href="style.css">
</head>
<body>
<h1>Welcome to the best form on Internet!</h1>
<form aciton ="/myaction.php" name="myForm" onsubmit="return validateForm()" method="post">
<div class="formdesign" id="name">
Name: <input type="text" name="fname" required><b><span class="formerror"> </span></b>
</div>
<div class="formdesign" id="email">
Email: <input type="email" name="femail" required><b><span class="formerror"> </span></b>
</div>
<div class="formdesign" id="phone">
Phone: <input type="phone" name="fphone" required><b><span class="formerror"></span></b>
</div>
<div class="formdesign" id="pass">
Password: <input type="password" name="fpass" required><b><span class="formerror"</span></b>
</div>
<div class="formdesign" id="cpass">
Confirm Password: <input type="password" name="fcpass" required><b><span class="formerror"></span></b>
</div>
<input class="but" type="submit" value="Submit">
</form>
</body>
<script src="index.js"></script>
</html>
2.STYLE.CSS
body {
padding: 10px 50px;
}
.formdesign {
font-size: 20px;
}
.formdesign input {
width: 50%;
padding: 12px 20px;
border: 1px solid blue;
margin: 14px;
border-radius: 4px;
font-size: 15px;
}
.formerror {
color: red;
}
.but {
border-radius: 9px;
width: 100px;
height: 50px;
font-size: 25px;
margin: 22px 20px;
}
Comments
Post a Comment