HTML Form Validation Flashcards
1
Q
Required Attribute
A
Fields in our forms which are not optional
Ex:
<input type=”–” required”>
2
Q
Text Length
A
Attributes:
minlength & maxlength
Ex:
<input></input>
3
Q
Pattern
A
For cases when we want user input to follow specific guidelines, we use the pattern attribute and assign it a regular expression, or regex. Regular expressions are a sequence of characters that make up a search pattern. If the input matches the regex, the form can be submitted.
Ex:
<input type=”number” pattern=”[0-9] {14, 16}”