Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
113 changes: 95 additions & 18 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,104 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>T-Shirt Order Form</title>
</head>
<body>
<header>
<h1>Product Pick</h1>
<h1>T-Shirt Order Form</h1>
</header>

<main>
<form>
<!-- write your html here-->
<!--
try writing out the requirements first as comments
this will also help you fill in your PR message later-->
</form>
<section>
<h2>Order Your T-Shirt</h2>
<p>Please verify your identity and select your t-shirt preferences.</p>

<form id="tshirt-order-form">
<fieldset>
<legend>Customer Verification</legend>

<div>
<label for="customer-name">Name</label>
<input type="text"
id="customer-name"
name="customer-name"
required
minlength="2"
placeholder="Enter first and last name">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you think of another way to verify if the customer name is a valid name

Copy link
Author

@carlosyabreu carlosyabreu Feb 7, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Certainly!
Here is one alternative approaches to validating a customer name in HTML form controls:

Using pattern attribute with regex
This allows for more specific validation patterns:

Name

Must be at least 2 characters long

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, do that.

<p><small>Must be at least 2 characters long</small></p>
</div>

<div>
<label for="customer-email">Email Address</label>
<input type="email"
id="customer-email"
name="customer-email"
required
placeholder="example@domain.com">

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you also think of another way to verify if the customer email is a valid email?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Using multiple attributes for comprehensive validation

Email Address

We'll use this to verify your email format (6-254 characters)

<p><small>We'll use this to verify your account</small></p>
</div>
</fieldset>

<fieldset>
<legend>T-Shirt Customization</legend>

<div>
<p>Select T-Shirt Colour</p>
<div>
<input type="radio"
id="colour-red"
name="tshirt-colour"
value="red"
required>
<label for="colour-red">Red</label>
</div>
<div>
<input type="radio"
id="colour-blue"
name="tshirt-colour"
value="blue"
required>
<label for="colour-blue">Blue</label>
</div>
<div>
<input type="radio"
id="colour-green"
name="tshirt-colour"
value="green"
required>
<label for="colour-green">Green</label>
</div>
</div>

<div>
<label for="tshirt-size">Select T-Shirt Size</label>
<select id="tshirt-size"
name="tshirt-size"
required>
<option value="" disabled selected>Choose a size</option>
<option value="xs">XS (Extra Small)</option>
<option value="s">S (Small)</option>
<option value="m">M (Medium)</option>
<option value="l">L (Large)</option>
<option value="xl">XL (Extra Large)</option>
<option value="xxl">XXL (Double Extra Large)</option>
</select>
<p><small>All sizes are unisex</small></p>
</div>
</fieldset>

<div>
<button type="submit">Submit Order</button>
<button type="reset">Clear Form</button>
</div>
</form>
</section>
</main>

<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>&copy; 2026 - Carlos Abreu Shirt Store. All rights reserved.</p>
</footer>
</body>
</body>
</html>
Loading