Skip to content
Open
Show file tree
Hide file tree
Changes from 6 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
16 changes: 8 additions & 8 deletions Form-Controls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,18 +30,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 used HTML only.
- [x] I have used HTML only.
- [x] I have not used any CSS or JavaScript.

### HTML

- [ ] 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.
- [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 colour from a defined set of 3 colours.
- [x] I require one size from a defined set of 6 sizes.

## Resources

Expand Down
43 changes: 38 additions & 5 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,48 @@ <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-->
<fieldset>
<legend><h2>Personal Information</h2></legend>
Copy link

@tenzyns tenzyns Oct 5, 2025

Choose a reason for hiding this comment

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

do you think the legend tag can just have the text string without the h2 tag or have another inline tag like strong to replace h2 to make it bold?

<p>
<label for="firstname">Firstname:</label>
<input type="text" id="firstname" pattern=".*\S.*" title="firstname must not be only spaces" name="firstname" required minlength="2" />
<Label for="lastname">Lastname:</Label>
<input type="text" id="lastname" pattern=".*\S.*" title="lastname must not be only spaces" name="lastname" required minlength="2" />
Copy link

Choose a reason for hiding this comment

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

Do you think each input element can have its own p tag or div tag, for layout flexibility and accessibility?

Copy link
Author

Choose a reason for hiding this comment

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

used a div tag to separate the layout for the 2 input sections name and email.

Copy link

Choose a reason for hiding this comment

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

Nice one with the pattern and title. 👍

</p>
<p>
<label for="email">Email:</label>
<input type="email" id="email" name="email" required />
</p>
</fieldset>
<fieldset>
<legend><h2>Product Information</h2></legend>
Copy link

@tenzyns tenzyns Oct 5, 2025

Choose a reason for hiding this comment

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

strong tag is useful here instead of h2 inside legend tag.

Copy link
Author

Choose a reason for hiding this comment

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

took off the h2 tag as it turns out it was not doing anything for accessibility or semantics.

<p>
<label for="colour">Colour:</label>
<select id="colour" name="colour" required>
<option value="" disabled selected>Select a colour</option>
<option value="red">Red</option>
<option value="green">Green</option>
<option value="blue">Blue</option>
</select>
</p>
<p>
<label for="size">Size:</label>
<select id="size" name="size" required>
<option value="" disabled selected>Select a size</option>
<option value="xsmall">X-Small</option>
<option value="small">Small</option>
<option value="medium">Medium</option>
<option value="large">Large</option>
<option value="xlarge">X-Large</option>
<option value="xxlarge">XX-Large</option>
</select>
</p>
</fieldset>
Copy link

Choose a reason for hiding this comment

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

Is the form missing a submit button? could be useful in testing field validation, even without form action?

Copy link
Author

Choose a reason for hiding this comment

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

added a submit button to test the validation and prompts are given if the validation parameters are not met.

</form>
</main>
<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
<h2>By Mustaf Asani</h2>
</footer>
</body>
</html>
Loading