Skip to content
Closed
Changes from 8 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
99 changes: 74 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,76 @@
<!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>
</html>

<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="A project demonstrating webform controls" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>

<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<fieldset>
<legend>Customer Details</legend>
<div>
<label for="name">Name: </label>
<input type="text" id="name" name="name" minlength="3" maxlength="15" autocomplete="name"
placeholder="enter your name" required>
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.

Currently a user can enter a name consisting of only space characters (e.g., " "). Can you enforce a stricter validation rule using the pattern attribute to disallow any name that contains only space characters?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Thank for pointing this out. I hadn't considered that scenario.

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

These changes has now been applied.

</div>
<div>
<label for="email">Email: </label>
<input type="email" id="email" name="email" autocomplete="email" placeholder="enter your email"
pattern="^[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}$" required>
Comment thread
cjyuan marked this conversation as resolved.
Outdated
</div>
</fieldset>
<fieldset>
<legend>T-Shirt Color Preference</legend>
<label for="colour">Select a Colour</label>
<select id="colour" name="colour" required>
<option value="" disabled selected hidden>-- Select a Colour --</option>
<option value="Red">Red</option>
<option value="Green">Green</option>
<option value="Blue">Blue</option>
</select>
</fieldset>
<fieldset>
<legend>Choose Your T-Shirt Size</legend>
<label for="XS">
<input type="radio" id="XS" name="size" value="XS" required>
XS
</label>
<label for="S">
<input type="radio" id="S" name="size" value="S">
S
</label>
<label for="M">
<input type="radio" id="M" name="size" value="M">
M
</label>
<label for="L">
<input type="radio" id="L" name="size" value="L">
L
</label>
<label for="XL">
<input type="radio" id="XL" name="size" value="XL">
XL
</label>
<label for="XXL">
<input type="radio" id="XXL" name="size" value="XXL">
XXL
</label>
</fieldset>
<button type="submit">Submit</button>
</form>
</main>
<footer>
<h2>By Martha Ogunbiyi</h2>
</footer>
</body>

</html>