Pure plugin

Integrate with the Pure library
The plugin supports Pure v1.0.0.

Usage

The following piece of code is the starting point to validate the form made in Pure:
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/pure/1.0.0/pure-min.css" />
<link rel="stylesheet" href="/vendors/@form-validation/umd/styles/index.min.css" />
</head>
<body>
<form id="demoForm" method="POST">...</form>
<script src="https://cdnjs.cloudflare.com/ajax/libs/es6-shim/0.35.3/es6-shim.min.js"></script>
<script src="/vendors/@form-validation/umd/bundle/popular.min.js"></script>
<script src="/vendors/@form-validation/umd/plugin-pure/index.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function(e) {
FormValidation.formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
pure: new FormValidation.plugins.Pure(),
...
},
}
);
});
</script>
</body>
</html>
The sample code above assumes that the FormValidation files are placed inside the vendors directory. You might need to change the path depending on where you place them on the server.
The next sections list out some examples of various forms made with Pure.

Using the npm packages

If you are using a bundler such as Webpack, Rollup, Parcel or Vite, etc., to bundle your application, then it's recommended to use the FormValidation NPM packages.
  • Install the packages:
$ npm install @form-validation/bundle
$ npm install @form-validation/plugin-pure
  • Import and use the Pure plugin:
import { formValidation } from '@form-validation/bundle/popular';
import { Pure } from '@form-validation/plugin-pure';
formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
pure: new Pure(),
...
},
}
);

Horizontal form

Horizontal form

Stacked form

Stacked form

Changelog

v2.4.0
v2.0.0
  • Add the npm package
v1.0.0
  • First release