Form objects pattern implementation for Javascript.
IMPORTANT: See also acacha-forms.
npm install francauxach-forms --save
After package installation you could user this package using ES6 import:
import Form from 'francauxach-forms'
Then you can create any form object using constructor, for example a Register User form:
let form = new Form( { name: 'Franc Auxach', email: 'francauxach@gmail.com', password: '123456', password_confirmation: '123456', terms: 'true' } )
And the use form methods like post to submit form:
form.post('/register')
.then( response => {
console.log('Register done!')
//do what you need to do if register is ok
})
.catch( error => {
console.log('Register error!')
})
More info about this pattern at:
- http://crushlovely.com/journal/7-patterns-to-refactor-javascript-applications-form-objects/
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/20
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/21
- https://github.com/laracasts/Vue-Forms
- https://github.com/edstevo/laravel-vue-form
- Laravel Spark : see more info about forms at docs.
This video series:
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/20
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/21
Inspired the creation of this package. Also Laravel Spark .
- Form Objects at acacha.org wiki: in Catalan Language
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/19
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/20
- https://laracasts.com/series/learn-vue-2-step-by-step/episodes/21
- https://github.com/laracasts/Vue-Forms
- https://github.com/edstevo/laravel-vue-form