Skip to content

Commit

Permalink
Testing form validation
Browse files Browse the repository at this point in the history
  • Loading branch information
nWidart committed Sep 13, 2017
1 parent 5be5c85 commit 3753f19
Showing 1 changed file with 6 additions and 23 deletions.
29 changes: 6 additions & 23 deletions Modules/Page/Assets/js/components/PageForm.vue
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@
<div class="box-body">
<el-tabs type="card">
<el-tab-pane :label="localeArray.name" v-for="(localeArray, locale) in locales" :key="localeArray.name">

<el-form-item :label="translate('page', 'title')" class="el-form-item is-error">
<el-form-item :label="translate('page', 'title')"
:class="{'el-form-item is-error': form.errors.has('en.title') }">
<el-input v-model="page[locale].title" @change="slugifyTitle($event, locale)"></el-input>
<div class="el-form-item__error">Please input Activity name</div>
<div class="el-form-item__error" v-if="form.errors.has('en.title')" v-text="form.errors.first('en.title')"></div>
</el-form-item>
<el-form-item :label="translate('page', 'slug')">
<el-input v-model="page[locale].slug"></el-input>
Expand Down Expand Up @@ -129,30 +129,13 @@
'index': 'index',
'home': 'home',
},
errors: '',
form: new Form(),
}
},
methods: {
onSubmit() {
let vm = this;
const form = new Form(this.page);
form.post(route('api.page.page.store'))
.then(response => {
})
.catch(errors => {
console.log(errors.response.data.errors);
vm.errors = errors.response.data.errors;
});
// axios.post(route('api.page.page.store'), this.page)
// .then(response => {
// console.log(response);
// })
// .catch(response => {
// console.log(response.response.data);
// this.errors = response.response.data;
// })
this.form = new Form(this.page);
this.form.post(route('api.page.page.store'));
},
setPageTypes() {
axios.get(route('api.page.page-templates.index'))
Expand Down

0 comments on commit 3753f19

Please sign in to comment.