Skip to content
38 changes: 30 additions & 8 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -4,24 +4,46 @@
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="description" content="Choose your preferred T-shirt color and size." />
<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 method="get">

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.

Why introduce the method="get" attribute explicitly?

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.

GET is useful to search or view information, VS code made me add it and then later I realised it wasn't needed.

<!-- label for the name input -->
<label for="name">Name:</label>
<input type="text" id="name" name="name" required pattern=".*\S.*\S.*"><br><br>

<!-- label for the email input -->
<label for="email">Email:</label>
<input type="email" id="email" name="email" required><br><br>

<!--fieldset for tshirt color-->
<fieldset>
<legend>T-Shirt Color</legend>
<label><input type="radio" name="tshirt-color" value="red" required>Red</label><br>
<label><input type="radio" name="tshirt-color" value="blue">Blue</label><br>
<label><input type="radio" name="tshirt-color" value="green">Green</label><br>
</fieldset><br>

<!-- fieldset for tshirt size-->
<fieldset>
<legend>T-Shirt Size</legend>
<label><input type="radio" name="tshirt-size" value="extra-small" required>XS</label><br>
<label><input type="radio" name="tshirt-size" value="small">S</label><br>
<label><input type="radio" name="tshirt-size" value="medium">M</label><br>
<label><input type="radio" name="tshirt-size" value="large">L</label><br>
<label><input type="radio" name="tshirt-size" value="extra-large">XL</label><br>
<label><input type="radio" name="tshirt-size" value="double-extra-large">XXL</label><br>
</fieldset><br>
Comment on lines +26 to +41

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.

  • Why use type="radio" for T-Shirt color, and type="checkbox" for T-Shirt size?

  • Also, try using AI to find out how we could simplify the markup for radio buttons.

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 you for your feedback, hopefully I managed to correct the mistakes.

<button type="submit">Submit</button>
</form>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>By FATIMA ROUCHI</p>
</footer>
</body>
</html>
Loading