Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

Required fields*

6
  • Thank you so much, it works for required validation, but what should I do for use customer validators like min length? please check this link Commented Apr 14, 2023 at 12:27
  • @user21636825, in the function válidamente, inside the loop of errores, chech if error.type=='minlength' add a new object to the array errors and so. Note: generally if the error is required you should not add new error. Commented Apr 14, 2023 at 13:41
  • how can I prevent other errors when I get required? Commented Apr 14, 2023 at 13:56
  • When compare if required, if not fullfilled, instead of push, use errors=[{required: true, message: error.message }];return; Commented Apr 14, 2023 at 16:08
  • Sorry, you're in a fooreach, so you can not use return. You need, before the foreach, ask about if (errors && errors.find(x=>x.type=='required') I just update que answer Commented Apr 14, 2023 at 17:06