Skip to content

Commit 8b784c2

Browse files
Add title attributes to form fields for better validation messages
- Add title to Customer Name field explaining the 2-character requirement - Add title to Email field for clarity - Add title attributes to Colour and Size select fields - Improves UX by showing users what format is expected when validation fails Fixes feedback from cjyuan
1 parent d123b42 commit 8b784c2

1 file changed

Lines changed: 4 additions & 2 deletions

File tree

Form-Controls/index.html

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ <h1>T-Shirt Order Form</h1>
2222
id="name"
2323
name="name"
2424
pattern=".*\S.*\S.*"
25+
title="Please enter at least 2 characters (name must contain at least 2 non-space characters)"
2526
required
2627
>
2728
</div>
@@ -33,14 +34,15 @@ <h1>T-Shirt Order Form</h1>
3334
type="email"
3435
id="email"
3536
name="email"
37+
title="Please enter a valid email address (e.g., name@example.com)"
3638
required
3739
>
3840
</div>
3941

4042
<!-- Colour -->
4143
<div>
4244
<label for="colour">Choose a Colour</label>
43-
<select id="colour" name="colour" required>
45+
<select id="colour" name="colour" title="Please select a colour from the list" required>
4446
<option value="">Select a colour</option>
4547
<option value="black">Black</option>
4648
<option value="white">White</option>
@@ -51,7 +53,7 @@ <h1>T-Shirt Order Form</h1>
5153
<!-- Size -->
5254
<div>
5355
<label for="size">Choose a Size</label>
54-
<select id="size" name="size" required>
56+
<select id="size" name="size" title="Please select a size from the list" required>
5557
<option value="">Select a size</option>
5658
<option value="XS">XS</option>
5759
<option value="S">S</option>

0 commit comments

Comments
 (0)