Get started with formvalidation CDN
http://formvalidation.io/license/ licensed
Formvalidation is a lightweight library for validating user input in web forms.
Tags:- jQuery
- plugin
- validate
- validator
- form
- Bootstrap
- Foundation
- Pure
- SemanticUI
- UIKit
Stable version
Copied!
How to start using formvalidation CDN
<!DOCTYPE html>
<html>
<head>
<title>Get started with formvalidation CDN - cdnhub.io</title>
<link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/formvalidation/dist/css/formvalidation.min.css">
<script src="https://cdn.cdnhub.io/formvalidation/0.6.2-dev/js/formValidation.min.js"></script>
</head>
<body>
<form id="myForm" method="POST">
<div class="form-group">
<label for="name">Name:</label>
<input type="text" class="form-control" id="name" name="name" data-constraints="{required: {presence: true, message: 'Name is required'}}">
<div class="invalid-feedback"></div>
</div>
<div class="form-group">
<label for="email">Email:</label>
<input type="email" class="form-control" id="email" name="email" data-constraints="{required: {presence: true, message: 'Email is required'}, email: {message: 'Invalid email format'}}">
<div class="invalid-feedback"></div>
</div>
<button type="submit" class="btn btn-primary">Submit</button>
</form>
<script>
document.addEventListener('DOMContentLoaded', function() {
FormValidation.formValidation(
document.querySelector('#myForm'),
{
fields: {
name: {
validators: {
notEmpty: {message: 'The Name field is required'}
}
},
email: {
validators: {
notEmpty: {message: 'The Email field is required'},
emailAddress: {message: 'The Email field is not a valid email address'}
}
}
},
onValidate: function(event) {
if (event.isValid) {
alert('Form is valid');
} else {
alert('Form is invalid');
}
}
}
);
});
</script>
</body>
</html>
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!
Copied!