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">
</div>
<br>
<div>
<label for="email">Customer email:</label>
<input type="email" id="email" name="email" required placeholder="example123@gmail.com">
</div>
<br>
<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>
<label for="color-blue">Blue</label>
<input type="radio" id="color-green" name="color" value="green" required>
<label for="color-green">Green</label>
</fieldset>
<div>
<br>
<label for="size">Shirt size</label>
<select id="size" name="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>
</div>
<br>
<button type="submit">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