close #1975 Fixed: Widget modal form some inputs must be required
This commit is contained in:
parent
b3285a0cee
commit
bf0f61ab05
@ -9,16 +9,23 @@
|
|||||||
<div class="row">
|
<div class="row">
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<base-input
|
<base-input
|
||||||
|
required
|
||||||
|
class="required"
|
||||||
v-model="form.name"
|
v-model="form.name"
|
||||||
:label="text.name"
|
:label="text.name"
|
||||||
prepend-icon="fas fa-font"
|
prepend-icon="fas fa-font"
|
||||||
:placeholder="placeholder.name"
|
:placeholder="placeholder.name"
|
||||||
|
:error="form.errors.name[0]"
|
||||||
|
@input="form.errors.name[0] = ''"
|
||||||
inputGroupClasses="input-group-merge">
|
inputGroupClasses="input-group-merge">
|
||||||
</base-input>
|
</base-input>
|
||||||
</div>
|
</div>
|
||||||
|
|
||||||
<div class="col-md-12">
|
<div class="col-md-12">
|
||||||
<base-input
|
<base-input
|
||||||
|
required
|
||||||
|
class="required"
|
||||||
|
:error="form.errors.class[0]"
|
||||||
:label="text.type">
|
:label="text.type">
|
||||||
<span class="el-input__prefix">
|
<span class="el-input__prefix">
|
||||||
<span class="el-input__suffix-inner el-select-icon">
|
<span class="el-input__suffix-inner el-select-icon">
|
||||||
@ -27,6 +34,7 @@
|
|||||||
</span>
|
</span>
|
||||||
<el-select
|
<el-select
|
||||||
class="select-primary"
|
class="select-primary"
|
||||||
|
@change="form.errors.class[0] = ''"
|
||||||
v-model="form.class" filterable
|
v-model="form.class" filterable
|
||||||
:placeholder="placeholder.type">
|
:placeholder="placeholder.type">
|
||||||
<el-option v-for="(name, value) in types"
|
<el-option v-for="(name, value) in types"
|
||||||
@ -208,7 +216,11 @@ export default {
|
|||||||
name: this.name,
|
name: this.name,
|
||||||
width: this.width,
|
width: this.width,
|
||||||
sort: this.sort,
|
sort: this.sort,
|
||||||
dashboard_id: this.dashboard_id
|
dashboard_id: this.dashboard_id,
|
||||||
|
errors: {
|
||||||
|
name: [],
|
||||||
|
class: [],
|
||||||
|
}
|
||||||
},
|
},
|
||||||
display: this.show
|
display: this.show
|
||||||
};
|
};
|
||||||
@ -237,21 +249,27 @@ export default {
|
|||||||
|
|
||||||
axios.post(path, data)
|
axios.post(path, data)
|
||||||
.then(function (response) {
|
.then(function (response) {
|
||||||
self.form.loading = false;
|
self.form.loading = false;
|
||||||
|
|
||||||
if (response.data.redirect) {
|
if (response.data.redirect) {
|
||||||
self.form.loading = true;
|
self.form.loading = true;
|
||||||
|
|
||||||
window.location.href = response.data.redirect;
|
window.location.href = response.data.redirect;
|
||||||
}
|
}
|
||||||
|
|
||||||
self.form.response = response.data;
|
if (response.errors) {
|
||||||
})
|
self.form.errors = error.response.data.errors;
|
||||||
.catch(function (error) {
|
|
||||||
this.errors.record(error.response.data.errors);
|
|
||||||
|
|
||||||
self.form.loading = false;
|
self.form.loading = false;
|
||||||
});
|
}
|
||||||
|
|
||||||
|
self.form.response = response.data;
|
||||||
|
})
|
||||||
|
.catch(function (error) {
|
||||||
|
self.form.errors = error.response.data.errors;
|
||||||
|
|
||||||
|
self.form.loading = false;
|
||||||
|
});
|
||||||
},
|
},
|
||||||
|
|
||||||
onCancel() {
|
onCancel() {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user