
Security News
Crates.io Implements Trusted Publishing Support
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
form-backend-validation
Advanced tools
THIS PACKAGE IS STILL IN DEVELOPMENT, DO NOT USE (YET)
Wouldn't it be great if you could just use your back end to validate forms on the front end? This package provides a Form
class does exactly that. It can post itself to a configured endpoint and manage errors. The class meant to be used in a Vue
component and works out of the box with a Laravel back end.
Take a look at the usage section to view a detailed example on how to use it.
The code of this package is based on the Object-Oriented Forms lesson in the Vue 2.0 series on Laracasts.
You're free to use this package (it's MIT-licensed), but if it makes it to your production environment we highly appreciate you sending us a postcard from your hometown, mentioning which of our package(s) you are using.
Our address is: Spatie, Samberstraat 69D, 2060 Antwerp, Belgium.
The best postcards will get published on the open source page on our website.
You can install the package via yarn:
$ yarn add form-backend-validation
This is an example of a fully configured form that could be built up in a Blade
view.
<form @submit.prevent="onSubmit" @keydown="form.errors.clear($event.target.name)">
<div>
<label for="name">Name:</label>
<input type="text" name="name" v-model="form.name">
<span v-if="form.errors.has('name')" v-text="form.errors.get('name')"></span>
</div>
<div>
<label for="text">Text:</label>
<input type="text" name="text" v-model="form.text">
<span v-if="form.errors.has('text')" v-text="form.errors.get('text')"></span>
</div>
<div>
<button :disabled="form.errors.any()">Create news item</button>
</div>
</form>
This is an example of a Vue
component that uses the provided Form
class.
new Vue({
el: '#app',
data: {
form: new Form({
name: '',
text: ''
})
},
methods: {
onSubmit() {
this.form.submit('post', '/newsItems');
}
}
});
Please see CHANGELOG for more information what has changed recently.
$ npm run test
Please see CONTRIBUTING for details.
If you discover any security related issues, please contact Freek Van der Herten instead of using the issue tracker.
Initial code of this package was copied from Jeffrey Way's Vue-Forms repo
Spatie is a webdesign agency based in Antwerp, Belgium. You'll find an overview of all our open source projects on our website.
The MIT License (MIT). Please see License File for more information.
FAQs
An easy way to validate forms using back end logic
The npm package form-backend-validation receives a total of 5,667 weekly downloads. As such, form-backend-validation popularity was classified as popular.
We found that form-backend-validation demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Crates.io adds Trusted Publishing support, enabling secure GitHub Actions-based crate releases without long-lived API tokens.
Research
/Security News
Undocumented protestware found in 28 npm packages disrupts UI for Russian-language users visiting Russian and Belarusian domains.
Research
/Security News
North Korean threat actors deploy 67 malicious npm packages using the newly discovered XORIndex malware loader.