You have code that is (most likely) heavily tested and also updated on a regular basis.
If they are empty we check each and set a specific error for each. See the Pen form validation 1 by Raymond Camden (@cfjedimaster) on Code Pen.For the second example, the second text field (age) was switched to email which will be validated with a bit of custom logic.The code is taken from the Stack Overflow question, How to validate email address in Java Script? This is an awesome question because it makes your most intense Facebook political/religious argument look like a slight disagreement over who makes the best beer. Here is the HTML, even though it’s really close to the first example. You can play with this example here: See the Pen form validation 2 by Raymond Camden (@cfjedimaster) on Code Pen. This tells Vue to cast the value to a number when you use it.The form will ask you to name a new product and will then check to ensure that the name is unique.We wrote a quick Open Whisk serverless action to do the validation.