Skip to content
Open
Show file tree
Hide file tree
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
41 changes: 21 additions & 20 deletions Form-Controls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@

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

- [ ] Interpret requirements and check against a list of criteria
- [ ] 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
- [x] Interpret requirements and check against a list of criteria
- [x] Write a valid form
- [x] Test with Devtools
- [x] Refactor using Devtools
- [x] Use version control by committing often and pushing regularly to GitHub
- [x] Develop the habit of writing clean, well-structured, and error-free code
<!--{{<objectives>}}>-->

## Task
Expand All @@ -29,7 +29,7 @@ All fields are required.
Do not write a form action for this project.

> [!TIP]
> 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.*`.
> 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.*`.
>
> 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!

Expand All @@ -39,18 +39,18 @@ Do not write a form action for this project.

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.
- [x] I have only used HTML and CSS.
- [x] 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.
- [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.
- [x] I require a valid email.
- [x] I require one colour from a defined set of 3 colours.
- [x] I require one size from a defined set of 6 sizes.

### Developers must adhere to professional standards.

Expand All @@ -59,12 +59,13 @@ Let's write out our testable criteria. Check each one off as you complete it.
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
- [x] My HTML code has no errors or warnings when validated using https://validator.w3.org/
- [x] My code is consistently formatted
- [x] My page content is free of typos and grammatical mistakes
- [x] I commit often and push regularly to GitHub

## 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)
Expand Down
62 changes: 54 additions & 8 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<!DOCTYPE html>
<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8" />
Expand All @@ -12,16 +12,62 @@
<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-->
<form class="form">
<label for="name">Name:</label>
<input type="text" name="name" id="name" minlength="2" required />

<br /><br />

<label for="email"> Email:</label>
<input type="email" name="email" id="email" required />

<br /><br />

<label for="colour"> Colour: </label>
<select name="colour" id="colour" required>
<option value="select" selected disabled>Select</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="red">Red</option>
</select>

<br /><br />

<fieldset>
<legend>Size</legend>

<label for="XS">XS</label>
<input type="radio" name="size" id="XS" value="XS" required />
<br /><br />

<label for="S">S</label>
<input type="radio" name="size" id="S" value="S" />
<br /><br />

<label for="M">M</label>
<input type="radio" name="size" id="M" value="M" />
<br /><br />

<label for="L">L</label>
<input type="radio" name="size" id="L" value="L" />
<br /><br />

<label for="XL">XL</label>
<input type="radio" name="size" id="XL" value="XL" />
<br /><br />

<label for="XXL">XXL</label>
<input type="radio" name="size" id="XXL" value="XXL" />
<br /><br />
</fieldset>

<br /><br />

<button type="submit">Submit</button>
</form>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>Ahmed Elmahmoudi</p>
</footer>
</body>
</html>
Loading