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
50 changes: 50 additions & 0 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,54 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>Form</title>
</head>
<body>
<form action="results.html" 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.

The spec has this requirement:

Do not write a form action for this project.

<div>
<h3>
Your T-Shirt Information
</h3>
<label for="name">Full Name:</label>
<input type="text" name="name" id="name" placeholder="First name" required>
<input type="text" name="name" id="name" placeholder="Last name" required>
Comment on lines +15 to +16
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.

Note: Supposedly the form should only have one element for name input. i.e. no need separate input elements for last and first names.

</div>
<div>
<label for="email">Email:</label>
<input type="email" name="email" id="email" placeholder="Email" required>
</div>
<br>
Pick your favourite T-shirt colour:
<div>
<input type="radio" name="color" id="black" value="black">
<label for="black">Mysterious Black</label>
Comment on lines +25 to +26
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: With this syntax, you would not need to introduce id and for atttributes.

<label>
  <input type="radio" name="..." value="...">
  Radio button text 
</label>

<input type="radio" name="color" id="white" value="white">
<label for="white">Bright White</label>
<input type="radio" name="color" id="violet" value="violet">
<label for="violet">Nano Violet</label>
</div>
<div>
<label for="color">Colour Reference:</label>
<input type="color" name="color" id="color">
Comment on lines +33 to +34
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.

Please note that adding form elements that are not defined in the specification is generally discouraged, as the implementation should remain aligned with the approved requirements.

</div>
<div>
<label for="T-shirtSize">T-shirt Size:</label>
<select name="T-shirtSize" id="T-shirtSize" id="T-shirt Size" required>
<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>
Comment on lines +38 to +45
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.

Can you find out how to configure a <select> element so that no option is selected by default, allowing the user to make an explicit choice?

</div>
<br>
<button type="submit">Submit</button>
</form>
</body>
</html><!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand Down
Loading