|
8 | 8 | - [ ] Write a valid form |
9 | 9 | - [ ] Test with Devtools |
10 | 10 | - [ ] Refactor using Devtools |
| 11 | +- [ ] Use version control by committing often and pushing regularly to GitHub |
| 12 | +- [ ] Develop the habit of writing clean, well-structured, and error-free code |
11 | 13 | <!--{{<objectives>}}>--> |
12 | 14 |
|
13 | 15 | ## Task |
14 | 16 |
|
15 | | -We are selling t-shirts. Write a form to collect the following data: |
| 17 | +We are selling T-shirts. Write a form to collect the following data: |
16 | 18 |
|
17 | 19 | 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. |
18 | 20 |
|
19 | 21 | Writing that out as a series of questions to ask yourself: |
20 | 22 |
|
21 | | -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. |
22 | | -2. What is the customer's email? I must make sure the email is valid. Email addresses have a consistent pattern. |
23 | | -3. What colour should this t-shirt be? I must give 3 options. How will I make sure they don't pick other colours? |
24 | | -4. What size does the customer want? I must give the following 6 options: XS, S, M, L, XL, XXL |
| 23 | +1. What is the customer's name? I must collect this data and ensure it contains at least two non-space characters. |
| 24 | +2. What is the customer's email? I must make sure the email is valid. Email addresses follow a consistent pattern. |
| 25 | +3. What colour should this T-shirt be? I must provide 3 options. How will I ensure they do not choose other colours? |
| 26 | +4. What size does the customer want? I must provide the following 6 options: XS, S, M, L, XL, XXL |
25 | 27 |
|
26 | 28 | All fields are required. |
27 | 29 | Do not write a form action for this project. |
28 | 30 |
|
29 | | -## Developers must test their work. |
| 31 | +> [!TIP] |
| 32 | +> To check whether the customer's name contains at least two non-space characters you may need to use a **regular expression** (or **regex** for short), which is a tool used to match patterns in text. If you wish to learn more about regular expressions there are plenty of resources on the web including the [official MDN documentation](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_expressions), but for this task you can use this regex that we have pre-written for you: `.*\S.*\S.*`. |
| 33 | +> |
| 34 | +> Now you have the regular expression, it's up to you to figure out how to use it in the context of an HTML form! |
| 35 | +
|
| 36 | +## Acceptance Criteria |
| 37 | + |
| 38 | +### Developers must test their work. |
30 | 39 |
|
31 | 40 | Let's write out our testable criteria. Check each one off as you complete it. |
32 | 41 |
|
33 | | -- [ ] I have used HTML only. |
34 | | -- [x] I have not used any CSS or JavaScript. |
| 42 | +- [ ] I have only used HTML and CSS. |
| 43 | +- [ ] I have not used any JavaScript. |
35 | 44 |
|
36 | 45 | ### HTML |
37 | 46 |
|
38 | | -- [ ] My form is semantic html. |
| 47 | +- [ ] My form is semantic HTML. |
39 | 48 | - [ ] All inputs have associated labels. |
40 | 49 | - [ ] My Lighthouse Accessibility score is 100. |
41 | | -- [ ] I require a valid name. I have defined a valid name as a text string of two characters or more. |
| 50 | +- [ ] I require a valid name. |
42 | 51 | - [ ] I require a valid email. |
43 | 52 | - [ ] I require one colour from a defined set of 3 colours. |
44 | 53 | - [ ] I require one size from a defined set of 6 sizes. |
45 | 54 |
|
46 | | -## Resources |
| 55 | +### Developers must adhere to professional standards. |
| 56 | + |
| 57 | +> Before you say you're done: Is your code readable? Does it run correctly? Does it look professional? |
47 | 58 |
|
| 59 | +These practices reflect the level of quality expected in professional work. |
| 60 | +They ensure your code is reliable, maintainable, and presents a polished, credible experience to users. |
| 61 | + |
| 62 | +- [ ] My HTML code has no errors or warnings when validated using https://validator.w3.org/ |
| 63 | +- [ ] My code is consistently formatted |
| 64 | +- [ ] My page content is free of typos and grammatical mistakes |
| 65 | +- [ ] I commit often and push regularly to GitHub |
| 66 | + |
| 67 | +## Resources |
48 | 68 | - [MDN: Form controls](https://developer.mozilla.org/en-US/docs/Learn/Forms) |
49 | 69 | - [MDN: Form validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation) |
50 | 70 | - [Lighthouse](https://developers.google.com/web/tools/lighthouse) |
51 | 71 | - [Lighthouse Guide](https://programming.codeyourfuture.io/guides/testing/lighthouse) |
| 72 | +- [Format Code and Make Logical Commits in VS Code](../practical_guide.md) |
0 commit comments