Bulma plugin
Integrate with the Bulma framework
The plugin supports
Bulma v0.7.4.
Usage
The following piece of code is the starting point to validate the form made in Bulma:
<html>
<head>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/bulma/0.7.4/css/bulma.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-bulma/index.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', function(e) {
FormValidation.formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
bulma: new FormValidation.plugins.Bulma(),
...
},
}
);
});
</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 Bulma.
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-bulma
- Import and use the Bulma plugin:
import { formValidation } from '@form-validation/bundle/popular';
import { Bulma } from '@form-validation/plugin-bulma';
formValidation(
document.getElementById('demoForm'),
{
fields: {
...
},
plugins: {
bulma: new Bulma(),
...
},
}
);
Horizontal form
Stacked form
Multiple fields on the same row
Multiple fields on the same row
Changelog
- The plugin doesn't add the error styles to
select
elements