Alternatively you can define all your validations at once using a simple schema.
Schema validation will be used if you pass an object to any of the validator methods.
You may pass per-validator error messages with the Returns an object of errors, where the key is the parameter name, and the value is an error object as returned by the error formatter.
Because of historical reasons, by default this method will return the last error of each parameter.
For example, you don't want to process a form that's missing critical information.
When you restrict the values that users can enter in forms, you reduce the chance that someone can enter a value that can compromise the security of your site.
You don't need to do that when i) using HTML 5 type="number" attribute, ii) and the step attribute is not specified, or its value is an integer The thousands and decimal separators might take different value in certain countries.
The following table introduces some popular values that are defined by various countries.
You might also have certain restrictions on the values.
Even if users correctly enter an integer, for example, you might need to make sure that the value falls within a certain range.