| Learn | HTML - Input Control Elements - Input validation |
|---|
| Input Validation HTML input validation is done automatically by the browser based on special attributes on the input element. It could partially or completely replace JavaScript input validation. This kind of validation can be circumvented by the user via specially crafted HTTP requests, so it does not replace server-side input validation. The validation only occurs when attempting to submit the form, so all restricted inputs must be inside a form in order for validation to occur (unless you're using JavaScript). Keep in mind that inputs which are disabled or read-only will not trigger validation. Some newer input types (like RequiredUse the Minimum / Maximum LengthUse the Specifying a rangeUse Match a PatternFor more control, use the Here's the message shown in Google Chrome version 51 when attempting to submit the form with an invalid value inside this field: Not all browsers display a message for invalid patterns, although there is full support among most used modern browsers. Check the latest support on CanIUse (opens new window) and implement accordingly. Accept File TypeFor input fields of type Multiple values can be specified with a comma, e.g.: Note: Adding The form has fields that are required for "publishing" the draft but aren’t required for "saving" the draft. |
Read Article
https://develop.horje.com/learn/1434/reference