Skip to content
102 changes: 78 additions & 24 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,81 @@
<!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>
<header>
<h1>Product Pick</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>
</main>
<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
</footer>
</body>

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="T-Shirt Order Form" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>

<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<!-- Customer Name Input -->
<p>
<label for="customerName">Name:</label>
<input type="text" id="customerName" name="customerName" required minlength="3"
pattern=".*\S.*\S.*" placeholder="Enter your full name">
Comment on lines +21 to +22
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The regular expression (value of pattern) looks good, but
if you set minlength to 3, then the input element would not accept name like "CJ".

</p>

<!-- Customer Email Input -->
<p>
<label for="emailAddress">Email:</label>
<input type="email" id="emailAddress" name="emailAddress" required placeholder="you@gmail.com"
pattern="^[^@\s]+@[^@\s]+\.[^@\s]+$"
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This regular expression is relatively advanced. If someone asked your what it means, can you explain what it means?

title="Please enter a valid email address (e.g., user@gmail.com). Domain parts (like 'gmail') must start and end with a letter or number, can contain hyphens, and must be separated by dots. Ends with a top-level domain (e.g., .com).">
</p>

<!-- T-Shirt Colour Selection -->
<fieldset>
<legend>Choose T-Shirt Colour:</legend>
<p>
<label>
<input type="radio" name="shirt-colour" value="red" required>
Red
</label>
</p>
<p>
<label>
<input type="radio" name="shirt-colour" value="blue" required>
Blue
</label>
</p>
<p>
<label>
<input type="radio" name="shirt-colour" value="green" required>
Green
</label>
</p>
</fieldset>

<!-- T-Shirt Size Selection -->
<p>
<label for="shirtSize">Choose Size:</label>
<select id="shirtSize" name="shirtSize" required>
<option value="">-- Please choose a size --</option>
<option value="xs">XS</option>
<option value="s">S</option>
<option value="m">M</option>
<option value="l">L</option>
<option value="xl">XL</option>
<option value="xxl">XXL</option>
</select>
</p>

<!-- Submit Section Button -->
<p>
<button type="submit">Place Order</button>
</p>
</form>
</main>
<footer>
<h2>By Gideon Defar</h2>
</footer>
</body>

</html>
Loading