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
60 changes: 56 additions & 4 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,66 @@ <h1>Product Pick</h1>
<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-->
<!-- requirements,
customer name, must have at least two characters
Customers email must have format text@text.text
Colour choice, must be one of red, blue or green
Size choice must be Xs, S, M, L, XL, XXL
-->

<style>
label {
font-size: 24px;
}
</style>
Comment on lines +24 to +28
Copy link
Contributor

Choose a reason for hiding this comment

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

Normal practice is to keep embedded CSS in the <head> section.


<div>
<!-- Name: at least 2 characters -->
<label for="name">Name:</label>
<input type="text" id="name" name="name" required pattern=".{2,}" title="Name must be at least 2 characters long">
Copy link
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 pattern to disallow any name that contains only space characters?

Note: To enforce minimum number of characters in the input, it is better to use the minlength attribute.

</div>
<div>
<!-- Email: basic format text@text.text -->
<label for="email">Email:</label>
<input type="email" id="email" name="email" required pattern="^[^@\s]+@[^@\s]+\.[^@\s]+$" title="Enter a valid email like user@example.com">
Copy link
Contributor

Choose a reason for hiding this comment

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

Why use pattern in <input type="email"> when browsers can already perform built-in email validation?

</div>
<div>
<!-- Colour choice: red, blue, green -->
<label for="colour">Colour:</label>
<select id="colour" name="colour" required>
<option value="">Select a colour</option>
<option value="red">Red</option>
<option value="blue">Blue</option>
<option value="green">Green</option>
</select>
</div>
<div>
<!-- Size choice: XS, S, M, L, XL, XXL -->
<label for="size">Size:</label>
<select id="size" name="size" required>
<option value="">Select a size</option>
<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>
</div>

Comment on lines +60 to +63
Copy link
Contributor

Choose a reason for hiding this comment

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

The indentation of some of the code is off. Can you improve the indentation?

VSCode's "Format Document" feature can help us format our code for better readability and consistency.
To use the feature, right-click inside the code editor and select the option.


<button type="submit">Submit</button>
</form>
</main>
<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
<h2>
<style>
h2 {
font-size: 10px;

</style>
By Damian Dunkley for Code your Future ITP Jan 2026 Sprint 2</h2>
</footer>
</body>
</html>