Form Validation showing error twice
Hi Team,
There is an issue with the form validation showing the same error message twice in the sweetalert. I'm sure you've noticed this ,but if you have not it's a super easy change.
This is due to the response having the same error multiple times.
Example -
{message: "Trailer ID is already taken", errors: {trailer_id: ["Trailer ID is already taken"]}}
errors: {trailer_id: ["Trailer ID is already taken"]}
trailer_id: ["Trailer ID is already taken"]
0: "Trailer ID is already taken"
message: "Trailer ID is already taken"
Instead of passing
let a = e.response.data.message, t = e.response.data.errors;
Changes below -
.catch(function (e) {
let p = e.response.data.message;
e.response && Swal.fire({
text: p,
icon: "error",
buttonsStyling: !1,
confirmButtonText: "Ok, got it!",
customClass: {
confirmButton: "btn btn-primary"
}
}
)
}
Replies (4)
Hi Eric,
Thank you for your suggestion.
Could you please share which js file are you referring to?
Thanks
Public/demo1/js/custom/authentication/sign-in/general.js
Thank you for your info.
I could not be able to manage depends rules in validation.js
can somebody help me?