Javatpoint Logo
Javatpoint Logo

ES6 Validations

Validation is the process of checking whether the information provided by the front-end user is correct or not as per the requirements. If the data provided by the client was incorrect or missing, then the server will have to send that data back to the client and request for resubmitting the form with the correct information.

Generally, the validation process is done at the server-side, which sends that validation information to the front-end user. This process wastes the execution time and user time.

JavaScript gives us a way to validate the form's data before sending it to the server-side. Validation in forms generally performs two functions, which are as follows:

  • Basic validation- It is a process to make sure that all of the mandatory fields are filled or not.
  • Data Format validation- As its name implies, it is the process to check that entered data is correct or not. We have to include appropriate logic for testing the correctness of data.

Let us try to elaborate on the basic form validation and data format validation.

Basic Form Validation

It validates the mandatory input fields of the form, whether the required fields are filled or not.

Let us understand the process of basic form validation by using the following example.

Example

Output

Data Format Validation

In data format validation, there is the checking of the entered data for the correct value. It validates already filled input fields that whether the filled information is correct or not.

Let's understand the concept of data format validation with the following example.

Example

Output


Next TopicES6 Animation




Help Others, Please Share

facebook twitter pinterest

Learn Latest Tutorials


Preparation


Trending Technologies


B.Tech / MCA