Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
16 commits
Select commit Hold shift + click to select a range
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
19 changes: 18 additions & 1 deletion Form-Controls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,10 @@

<!--{{<objectives>}}>-->

- [x] Interpret requirements and check against a list of criteria
- [x] Write a valid form
- [x] Test with Devtools
- [x] Refactor using Devtools
- [ ] Interpret requirements and check against a list of criteria
- [ ] Write a valid form
- [ ] Test with Devtools
Expand All @@ -16,10 +20,14 @@

We are selling T-shirts. Write a form to collect the following data:

Our customers already have accounts, so we know their addresses and charging details already. We don't need to collect that data. We want to confirm they are the right person, then get them to choose a colour and size.
Our customers already have accounts, so we know their addresses and charging details already. We don't need to collect that data. We want to confirm they are the right person, then get them to choose a color and size.

Writing that out as a series of questions to ask yourself:

1. What is the customer's name? I must collect this data, and validate it. But what is a valid name? I must decide something.
2. What is the customer's email? I must make sure the email is valid. Email addresses have a consistent pattern.
3. What color should this t-shirt be? I must give 3 options. How will I make sure they don't pick other colors?
4. What size does the customer want? I must give the following 6 options: XS, S, M, L, XL, XXL
1. What is the customer's name? I must collect this data and ensure it contains at least two non-space characters.
2. What is the customer's email? I must make sure the email is valid. Email addresses follow a consistent pattern.
3. What colour should this T-shirt be? I must provide 3 options. How will I ensure they do not choose other colours?
Expand All @@ -34,11 +42,20 @@ Do not write a form action for this project.

Let's write out our testable criteria. Check each one off as you complete it.

- [x] I have used HTML only.
- [x] I have not used any CSS or JavaScript.
- [ ] I have only used HTML and CSS.
- [ ] I have not used any JavaScript.

### HTML

- [x] My form is semantic html.
- [x] All inputs have associated labels.
- [x] My Lighthouse Accessibility score is 100.
- [x] I require a valid name. I have defined a valid name as a text string of two characters or more.
- [x] I require a valid email.
- [x] I require one color from a defined set of 3 colors.
- [x] I require one size from a defined set of 6 sizes.
- [ ] My form is semantic HTML.
- [ ] All inputs have associated labels.
- [ ] My Lighthouse Accessibility score is 100.
Expand Down
41 changes: 36 additions & 5 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<title>Glasgow style product form</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
Expand All @@ -13,13 +13,44 @@ <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-->
<div>
<label for="name">Customer name:</label>
<input type="text" id="name" name="name" required placeholder="john smith">
Comment on lines +17 to +18
Copy link
Copy Markdown
Contributor

@Poonam-raj Poonam-raj May 11, 2026

Choose a reason for hiding this comment

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

A valid name is meant to have at least two characters or more. At the moment I can submit a name of "P" which doesn't follow our rules but is allowed by the form. Can you add validation to only allow 2 or more characters?
And can you communicate that rule if someone doesn't follow it?

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 for you for your feed back I will make the validation change and message you back

</div>
<br>
<div>
<label for="email">Customer email:</label>
<input type="email" id="email" name="email" required placeholder="example123@gmail.com">
</div>
<br>
<fieldset>
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.

Good use of fieldset

<legend>Pick a color of your choosing</legend>
<input type="radio" id="color-red" name="color" value="red" required>
<label for="color-red">Red</label>
<input type="radio" id="color-blue" name="color" value="blue" 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.

A additional thought:
All of your tags have the name "color" but you could be even more descriptive about the data we create here. Imagining we use this color in a t-shirt order, we might have other colours we want to add in future for the "design" on the t-shirt. Worth thinking about labelling this colour more descriptively so people know this is associated with "t-shirt colour"

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 feed back, I understand that is way of writing the code can send hard to understand data I will make correct change and message you back.

<label for="color-blue">Blue</label>
<input type="radio" id="color-green" name="color" value="green" required>
<label for="color-green">Green</label>
Comment on lines +28 to +33
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.

As an extension on this - it's worth thinking about how we communicate information as easily as possible. When selecting colours, it's nice to also see the colour associated. One way to improve this more is to add a colour to the radio buttons here

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 feed back, I will make this change and message you back when it done

</fieldset>
<div>
<br>
<label for="size">Shirt size</label>
<select id="size" name="shirt size" 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.

Here you've demonstrated a good naming choice in the "name" tag, using "shirt size" describes this data accurately

<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 +37 to +45
Copy link
Copy Markdown
Contributor

@Poonam-raj Poonam-raj May 11, 2026

Choose a reason for hiding this comment

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

Could wrap this in a fieldset tag too

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 the feed back, I will see which tags I can wrap this around and make change

</div>
<br>
<button type="submit">Submit</button>
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.

Demonstrates good practice by adding submit button

</form>
</main>
<hr>
<footer>
<p><strong>By Tuan Nguyen</strong></p>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
</footer>
Expand Down
Loading