Mask
Mask is still a limited form of validation. Its use requires the input data to be in a certain format.
Through a pattern you force each position typed to have a certain character, for example that it is always a numeric digit, or a dot, a bar, which is an uppercase letter, which is a numeric range (typical case when masking a date and can not accept day 32, month 13, or even day 30 in month 02, etc.).
Some masks can be quite sophisticated and variable as data is entered.
Depending on how to use some data such as dots, commas and bars can be considered part of the typed data or just a form of presentation. It can even search for auxiliary information that helps in mandatory formatting. But it can’t go beyond the data format.
Masks can be used only for presentation (data output, formatting). In this case it is clear that it will not validate anything.
Often the mask is aided by a placeholder, but he alone is not the mask since it does not prevent something wrong in that position from being typed wrong.
Although I avoid many people use a library to help assemble masks, like jQuery and other more modern.
Validation
To validation "pure" can always check other things, in general more complex rules, and it usually indicates whether the data is valid or not in a boolean form.
She can check the input format as well, but this usually decreases the user experience, unless she goes through each character typed. But it is not always possible, validation often needs to look at the whole and not just that character.
In some cases what is a task of one or the other can be confused, or even conflict if it is not well done.
Validation checks whether input is correct or in accordance with the specified pattern. Mask defines a formatting for input or displayed data.
– rray