7.12. Validation Controls
Whenever we solicit user input, the possibility exists that the user will make an error. If possible, we'd like to catch as many errors as possible before we process the form. For example, if we are accepting credit card information, we can verify that the user has entered a credit card number and expiration date. The credit card number should be all digits, of course, and for Visa and Mastercard it should be 16 digits in length. Beyond that, we can't determine if it represents a valid credit card number. Similarly, the expiration date's month should be between 1 and 12, the year should be equal to or greater than the current year, and so on.
Web Forms provides validation controls to simplify the checking of user input. ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access