Turret plugin
Integrate with the turretcss framework
Usage
The following piece of code is the starting point to validate the form made in turretcss:
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bigfishtv-turret/5.1.3/turretcss.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-turret/index.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function(e) {
FormValidation.formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
turret: new FormValidation.plugins.Turret(),
...
},
}
);
});
</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 turretcss.
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.
$ npm install @form-validation/bundle
$ npm install @form-validation/plugin-turret
- Import and use the Turret plugin:
import { formValidation } from '@form-validation/bundle/popular';
import { Turret } from '@form-validation/plugin-turret';
formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
turret: new Turret(),
...
},
}
);
Stacked form
You need to add the fv-stacked-form
class to the form
element such as:
<form class="fv-stacked-form">
...
</form>
Changelog
- Support Turret CSS v5.1.3
- First release. It means that the Turret plugin requires FormValidation v1.2.0 or newer