Most of our tasks as software engineers are related to forms. Sign up forms, sing in forms, onboarding forms, etc. So today we are going to practice how to validate any form data using accumulative errors so we can now in just one method invocation what are the errors our form contains.
Our task for today's practice is to write a program to be able to validate if the data contained in a form with the following information is valid or not.
- First name: It can't be empty.
- Lst name: It can't be empty.
- Birthdate. It has to be, at least, 18 years old.
- Document ID: A value containing eight digits and one letter.
- Phone number: Any combination of 9 numbers.
- Email: Any valid email.