Bootstrap

champak
Bootstrap
₹2,000.00 ₹300.00
  • 23 students
  • 13 lessons
  • 0 quizzes
  • 10 week duration

Bootstrap

Simple Bootstrap Validation

You can use different validation classes to provide valuable feedback to users. Add either .was-validated or .needs-validation to the <form> element, depending on whether you want to provide validation feedback before or after submitting the form It all depends on 2 classes. valid-feedback and invalid-feedback.Bootstrap will show the appropriate content .

 

A simple example.


<!DOCTYPE html>
<html lang="en">
<head>
<title>Bootstrap Example</title>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.4.0/jquery.min.js"></script>
<script src="https://cdnjs.cloudflare.com/ajax/libs/popper.js/1.14.7/umd/popper.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/4.3.1/js/bootstrap.min.js"></script>
</head>
<body>

<div class="container">
<h2>Simple Form Validation</h2>
<p class="bg-info">
You can use different validation classes to provide valuable feedback to users. Add either .was-validated or .needs-validation to the &lt;form&gt; element, depending on whether you want to provide validation feedback before or after submitting the form


It all depends on 2 classes. valid-feedback and invalid-feedback.Bootstrap will show the appropriate content
.</p>
<form action="" class="was-validated">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" placeholder="Enter Name" name="name" required>
<div class="valid-feedback">Valid.</div>
<div class="invalid-feedback">Please fill out this field.</div>
</div>
<div class="form-group">
<label for="pwd">Password:</label>
<input type="password" class="form-control" id="pwd" placeholder="Enter password" name="pwd" required>
<div class="valid-feedback ">Valid.</div>
<div class="invalid-feedback">Please fill your password.</div>
</div>
<div class="form-group">
<label for="email">EMail</label>
<input type="email" class="form-control" id="pwd" placeholder="Enter EMail" name="email" required>
<div class="valid-feedback ">Valid.</div>
<div class="invalid-feedback">Please fill your EMail.</div>
</div>
<div class="form-group">
<label for="marks">Marks</label>
<input type="number" class="form-control" min="0" max="100" id="pwd" placeholder="Enter Marks" name="marks" required>
<div class="valid-feedback ">Valid.</div>
<div class="invalid-feedback">Please fill marks between 0 and 100.</div>
</div>
<div class="form-group form-check">
<label class="form-check-label">
<input class="form-check-input" type="checkbox" name="remember" required> I agree
</label>
<div class="valid-feedback">Valid.</div>
<div class="invalid-feedback">Please agree to continue.</div>

</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
</div>

</body>
</html>

 

Leave a Reply

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