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
94 changes: 69 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,71 @@
<!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-->
<p>By HOMEWORK SOLUTION</p>
</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="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />

</head>

<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<fieldset>
<legend style="font-weight: bold;">Name and Email address</legend><!--Adding <legend> element for accessibility purposes-->
<label for="name">Name</label>
<input type="text" id="name" name="name" required><br><br><!--Input field for name, making it 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.

The spec has this requirement

What is the customer's name? I must collect this data and ensure it contains at least two non-space characters.

Can you update this input field to enforce that requirement?

<label for="email">Email:</label>
<input type="email" id="email" required><br><!--Input field for email address. Making it required-->
</fieldset>


<fieldset>
<legend style="font-weight: bold;">Please select a colour for your T-Shirt</legend>
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.

Note: Best practice is to move the CSS into an external .css file instead using inline CSS or embedding them within the HTML document. This improves maintainability, keeps the markup cleaner, and makes it easier to locate, update, and reuse styles across multiple pages.

No change is needed for this exercise.

<label for="Blue">
<input type="radio" id="Blue" name="colour" required>Blue
</label>
Comment on lines +30 to +32
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.

Note: If you embed <input> within <label>, use of id and for attributes are optional.

<label for="Red">
<input type="radio" id="Red" name="colour" required>Red
</label>
<label for="Green">
<input type="radio" id="Green" name="colour" required>Green
</label><!--Making radio buttons for Blue, Red and Green and making the require fields-->
</fieldset><br>
<fieldset>
<legend style="font-weight: bold;">Please select a size for your T-Shirt</legend>
<label for="XS"><!--Making radio buttons for XS, S, M, L, XL and XXL sizes, and making them required fields-->
<input type="radio" id="XS" name="size" required>XS
</label>
<label for="S">
<input type="radio" id="S" name="size" required>S
</label>
<label for="M">
<input type="radio" id="M" name="size" required>M
</label>
<label for="L">
<input type="radio" id="L" name="size" required>L
</label>
<label for="XL">
<input type="radio" id="XL" name="size" required>XL
</label>
<label for="XXL">
<input type="radio" id="XXL" name="size" required>XXL
</label>
</fieldset><br>
<div>
<button>Submit</button><!--Submit button-->
</div>
</form>
</main>
<footer>
<p>By Vito Moratti</p>
</footer>
</body>

</html>
Loading