Imagine some fancy stats and badges here
ankurk91 / laravel-form-validation Goto Github PK
View Code? Open in Web Editor NEWYet another form validation (JS) helper for Laravel. :open_umbrella:
License: MIT License
Yet another form validation (JS) helper for Laravel. :open_umbrella:
License: MIT License
hi,
it would be awesome if the breaking changes in registering the plugin could be fixed for a vue3 version
e.g. around
laravel-form-validation/src/index.ts
Line 9 in f10550e
Make this syntax possible
var user = new Form({
name: 'Foo',
});
user.email = '[email protected]`
console.log(user)
$data
just like vue.js._
Ref links
<template>
<b-modal id="create-page-modal" title="Add new page"
@hidden="resetModal"
@ok="handleOk">
<div class="form-group required">
<label>Sequence</label>
<input type="number"
class="form-control"
name="sequence"
v-model="page.sequence"
v-invalid="form.$errors">
<field-error :bag="form.$errors" field="sequence"/>
</div>
<template v-slot:modal-footer="{ ok, cancel }">
<button class="btn btn-secondary" @click="cancel()">
Cancel
</button>
<button class="btn btn-primary" :disabled="form.$pending" @click="ok()">
<span v-if="form.$pending">{{ form.$progress }}% Saving...</span>
<span v-else>
<i class="fas fa-check-circle"/> Save
</span>
</button>
</template>
</b-modal>
</template>
<script>
import Form from 'laravel-form-validation'
export default {
name: 'CreatePageModal',
props: {
documentId: {}
},
data() {
return {
form: new Form(),
page: {}
}
},
mounted() {
//
},
methods: {
handleOk(event) {
event.preventDefault();
this.submit()
},
resetModal() {
this.form.$errors.clear()
},
submit() {
this.form.post(this.postUrl, this.page)
.then((response) => {
this.$emit('saved', response, this.documentId);
this.$bvModal.hide('create-page-modal')
})
.catch((error) => {
// handle error
// this.$forceUpdate()
})
}
},
computed: {
postUrl() {
return 'documents/' + this.documentId + '/pages'
}
}
}
</script>
Try to submit the form and let validation error come from server, it wont be shown, the v-invalid
directive has an old copy of $errors
.
Possible Workaround (ugly):
this.$forceUpdate()
Hello @ankurk91
Thank you for your project
I think response on then() use axios format is better and not confused.
promise axios normal format is response.data.xxxx
and now response on catch() is ok
axios({
method: 'get',
url: 'http://bit.ly/2mTM3nY',
responseType: 'stream'
})
.then(function (response) {
response.data.xxxx
});
please consider.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.