diff --git a/Form-Controls/Form Control Lighthouse score.jpg b/Form-Controls/Form Control Lighthouse score.jpg new file mode 100644 index 000000000..cca0cf67b Binary files /dev/null and b/Form-Controls/Form Control Lighthouse score.jpg differ diff --git a/Form-Controls/README.md b/Form-Controls/README.md index 844572470..ddee6e2d5 100644 --- a/Form-Controls/README.md +++ b/Form-Controls/README.md @@ -8,60 +8,44 @@ - [ ] Write a valid form - [ ] Test with Devtools - [ ] Refactor using Devtools -- [ ] Use version control by committing often and pushing regularly to GitHub -- [ ] Develop the habit of writing clean, well-structured, and error-free code ## Task -We are selling T-shirts. Write a form to collect the following data: +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. Writing that out as a series of questions to ask yourself: -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? -4. What size does the customer want? I must provide the following 6 options: XS, S, M, L, XL, XXL +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 colour should this t-shirt be? I must give 3 options. How will I make sure they don't pick other colours? +4. What size does the customer want? I must give the following 6 options: XS, S, M, L, XL, XXL All fields are required. Do not write a form action for this project. -## Acceptnce Criteria - -### Developers must test their work. +## Developers must test their work. Let's write out our testable criteria. Check each one off as you complete it. -- [ ] I have only used HTML and CSS. -- [ ] I have not used any JavaScript. +- [✅] I have only used HTML and CSS. +- [✅] I have not used any JavaScript. ### HTML -- [ ] My form is semantic HTML. -- [ ] All inputs have associated labels. -- [ ] My Lighthouse Accessibility score is 100. -- [ ] I require a valid name. -- [ ] I require a valid email. -- [ ] I require one colour from a defined set of 3 colours. -- [ ] I require one size from a defined set of 6 sizes. - -### Developers must adhere to professional standards. - -> Before you say you're done: Is your code readable? Does it run correctly? Does it look professional? - -These practices reflect the level of quality expected in professional work. -They ensure your code is reliable, maintainable, and presents a polished, credible experience to users. - -- [ ] My HTML code has no errors or warnings when validated using https://validator.w3.org/ -- [ ] My code is consistently formatted -- [ ] My page content is free of typos and grammatical mistakes -- [ ] I commit often and push regularly to GitHub +- [✅] My form is semantic html. +- [✅] All inputs have associated labels. +- [✅] My Lighthouse Accessibility score is 100. +- [✅] I require a valid name. I have defined a valid name as a text string of two characters or more. +- [✅] I require a valid email. +- [✅] I require one colour from a defined set of 3 colours. +- [✅] I require one size from a defined set of 6 sizes. ## Resources + - [MDN: Form controls](https://developer.mozilla.org/en-US/docs/Learn/Forms) - [MDN: Form validation](https://developer.mozilla.org/en-US/docs/Learn/Forms/Form_validation) - [Lighthouse](https://developers.google.com/web/tools/lighthouse) - [Lighthouse Guide](https://programming.codeyourfuture.io/guides/testing/lighthouse) -- [Format Code and Make Logical Commits in VS Code](../practical_guide.md) diff --git a/Form-Controls/index.html b/Form-Controls/index.html index 74b591ffc..76356ac71 100644 --- a/Form-Controls/index.html +++ b/Form-Controls/index.html @@ -4,6 +4,7 @@ My form exercise + @@ -13,15 +14,102 @@

Product Pick

- - + + + + + + +

+ + + + + +

+ + + + + +

+ + + + + +

+ + + +
diff --git a/Form-Controls/style.css b/Form-Controls/style.css new file mode 100644 index 000000000..60be1b5e2 --- /dev/null +++ b/Form-Controls/style.css @@ -0,0 +1,40 @@ +body { + font-family: Arial, sans-serif; + background-color: #f4f4f4; + padding: 40px; +} + +h1 { + text-align: center; +} + +p { + text-align: center; +} + +form { + background-color: white; + max-width: 400px; + margin: 0 auto; + padding: 24px; + border-radius: 12px; + box-shadow: inset 0 0 0 2px #ccc; +} + +label { + font-weight: bold; +} + +input, +select, +button { + width: 100%; + padding: 10px; + margin-top: 6px; + margin-bottom: 16px; + box-sizing: border-box; +} + +button { + cursor: pointer; +} \ No newline at end of file