|
1 | 1 | <!doctype html> |
2 | 2 | <html lang="en"> |
3 | | - <head> |
4 | | - <title>HTML Form Validation</title> |
5 | | - </head> |
6 | | - <body> |
7 | | - <h1>HTML Form Validation</h1> |
8 | | - <form> |
9 | | - <label for="name">Name: </label |
10 | | - ><input type="text" name="name" minlength="2" required /><br /> |
11 | | - <label for="date">Date: </label |
12 | | - ><input |
13 | | - type="text" |
14 | | - name="date" |
15 | | - pattern="\d{2}/\d{2}/\d{4}" |
16 | | - required |
17 | | - /><br /> |
18 | | - <label for="email">Email: </label |
19 | | - ><input |
20 | | - type="text" |
21 | | - name="email" |
22 | | - pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" |
23 | | - required |
24 | | - /><br /> |
25 | | - <label for="website">Website: </label |
26 | | - ><input |
27 | | - type="text" |
28 | | - name="website" |
29 | | - pattern="(https?://)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}(\/[^\s]*)?" |
30 | | - required |
31 | | - /><br /> |
32 | | - <label for="phone">Phone Number: </label |
33 | | - ><input |
34 | | - type="text" |
35 | | - name="phone" |
36 | | - pattern="\d{3}-?\d{3}-?\d{4}" |
37 | | - required |
38 | | - /><br /> |
39 | | - <button type="submit">Submit</button> |
40 | | - </form> |
41 | | - </body> |
| 3 | + <head> |
| 4 | + <title>HTML Form Validation</title> |
| 5 | + </head> |
| 6 | + <body> |
| 7 | + <h1>HTML Form Validation</h1> |
| 8 | + <form> |
| 9 | + <label for="name">Name: </label |
| 10 | + ><input type="text" name="name" minlength="2" required /><br /> |
| 11 | + <label for="date">Date: </label |
| 12 | + ><input |
| 13 | + type="text" |
| 14 | + name="date" |
| 15 | + pattern="\d{2}/\d{2}/\d{4}" |
| 16 | + required |
| 17 | + /><br /> |
| 18 | + <label for="email">Email: </label |
| 19 | + ><input |
| 20 | + type="text" |
| 21 | + name="email" |
| 22 | + pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" |
| 23 | + required |
| 24 | + /><br /> |
| 25 | + <label for="website">Website: </label |
| 26 | + ><input |
| 27 | + type="text" |
| 28 | + name="website" |
| 29 | + pattern="(https?://)?[a-zA-Z0-9.-]+\.[a-zA-Z]{2,3}(\/[^\s]*)?" |
| 30 | + required |
| 31 | + /><br /> |
| 32 | + <label for="phone">Phone Number: </label |
| 33 | + ><input |
| 34 | + type="text" |
| 35 | + name="phone" |
| 36 | + pattern="\d{3}-?\d{3}-?\d{4}" |
| 37 | + required |
| 38 | + /><br /> |
| 39 | + <button type="submit">Submit</button> |
| 40 | + </form> |
| 41 | + </body> |
42 | 42 | </html> |
0 commit comments