this.errors is undefined
issue fixed
& fix typo
This commit is contained in:
6
resources/assets/js/plugins/error.js
vendored
6
resources/assets/js/plugins/error.js
vendored
@ -17,13 +17,15 @@ export default class Errors {
|
||||
}
|
||||
|
||||
get(field) {
|
||||
if (this.errors[field]) {
|
||||
if (this.has(field)) {
|
||||
return this.errors[field][0];
|
||||
}
|
||||
}
|
||||
|
||||
record(errors) {
|
||||
this.errors = errors;
|
||||
if (errors instanceof Object) {
|
||||
this.errors = errors;
|
||||
}
|
||||
}
|
||||
|
||||
clear(field) {
|
||||
|
10
resources/assets/js/plugins/form.js
vendored
10
resources/assets/js/plugins/form.js
vendored
@ -104,7 +104,7 @@ export default class Form {
|
||||
if (!this[form_element.getAttribute('data-field')][name].push) {
|
||||
this[form_element.getAttribute('data-field')][name] = [this[form_element.getAttribute('data-field')][name]];
|
||||
}
|
||||
|
||||
|
||||
if (form_element.checked) {
|
||||
this[form_element.getAttribute('data-field')][name].push(form_element.value);
|
||||
}
|
||||
@ -171,7 +171,7 @@ export default class Form {
|
||||
this[name] = form_element.value;
|
||||
}
|
||||
} else {
|
||||
|
||||
|
||||
if (form_element.dataset.type != undefined) {
|
||||
if (form_element.dataset.type == 'multiple') {
|
||||
this[name] = [];
|
||||
@ -383,7 +383,7 @@ export default class Form {
|
||||
}
|
||||
|
||||
submit() {
|
||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||
for (var name in data) {
|
||||
if (name == "previewElement" || name == "previewTemplate") {
|
||||
continue;
|
||||
@ -427,7 +427,7 @@ export default class Form {
|
||||
}
|
||||
|
||||
async asyncSubmit() {
|
||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||
FormData.prototype.appendRecursive = function(data, wrapper = null) {
|
||||
for (var name in data) {
|
||||
if (name == "previewElement" || name == "previewTemplate") {
|
||||
continue;
|
||||
@ -497,7 +497,7 @@ export default class Form {
|
||||
if (error.request.status == 419) {
|
||||
window.location.href = '';
|
||||
return;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
if (typeof this.errors != "undefined") {
|
||||
|
Reference in New Issue
Block a user