Super Sale Limited Time 50% OFF for All-Access Plans
Save 50% Now

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"
}
}
)
}


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(

Replies (4)


I could not be able to manage depends rules in validation.js
can somebody help me?



Thank you for your info.



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


Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(
Text formatting options
Submit
Click any option to insert into your comment. Select text first to wrap it.
  • **text** to make things bold
  • *text* to emphasize
  • ### Heading to make headings
  • [link text](url) for links
  • ![alt text](image-url) to paste in an image
  • - item to make a list
  • 1. item to make an ordered list
  • > quote to quote somebody
  • `code` for single line of code
  • ```js ... ``` for JS code block
  • ```html ... ``` for HTML code block
  • ```scss ... ``` for SCSS code block
  • ```php ... ``` for PHP code block
  • --- for a horizontal rule
  • happy  :)
  • shocked  :|
  • sad  :(