Skip to content
33 changes: 27 additions & 6 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,36 @@ <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-->
<!-- 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>

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: Chrome Developer Tools and AI tools may provide useful insights into how we can further improve our implementation. While you are not required to follow their suggestions in every exercise, taking the time to consider them can often help us learn more effectively.

Here's an example,

Image


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

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.

Indentation is slightly off.

Suggestion:

  • Look up the benefits of using a code formatter.
  • Install the Prettier extension for VS Code, then:
    • Use VS Code's Format Document feature to format your code.
    • Optionally, enable Format On Save and Format On Paste to keep your code consistently formatted.

Resource: Visual Studio Code - Formatting

Note: The formatter may not work correctly if your code contains syntax errors.

</fieldset><br>

<!-- fieldset for tshirt size-->
<fieldset>
<legend>T-Shirt Size</legend>
<label><input type="checkbox" id="extra-small" name="tshirt-size" value="extra-small" required>XS</label><br>
<label><input type="checkbox" id="small" name="tshirt-size" value="small" required>S</label><br>
<label><input type="checkbox" id="medium" name="tshirt-size" value="medium" required>M</label><br>
<label><input type="checkbox" id="large" name="tshirt-size" value="large" required>L</label><br>
<label><input type="checkbox" id="extra-large" name="tshirt-size" value="extra-large" required>XL</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