Skip to content
Open
Show file tree
Hide file tree
Changes from 5 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
121 changes: 96 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,98 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
<body>
<header>
<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>
</main>
<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
</footer>
</body>
</html>

<head>
<meta charset="utf-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<title>My form exercise</title>
<meta name="description" content="Order form">
<meta name="viewport" content="width=device-width, initial-scale=1">
<link rel="stylesheet" href="styles.css">
</head>

<body>
<header>
<h1>Product Pick</h1>
</header>
<main>
<form>
<div id="fn"><label for="fname">Please Enter your First name:</label>
<input type="text" id="fname" name="fname" pattern=".*\S.*\S.*"> <br>

@abdishakoor-dev abdishakoor-dev Sep 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The pattern attribute is right and does what the README asks. Once you've added a submit button, leave the name empty and submit. It goes through. What have you put on the email field on line 26 that this field doesn't have? Also, the task asks for one name field, not first and last.

</div>
<div id="sn"><label for="lname">Please Enter your Last name:</label>
<input type="text" id="lname" name="lname" pattern=".*\S.*\S.*"> <br>
</div>
<div id="em"><label for="email">Please Enter your Email:</label>
<input type="email" id="email" name="email" required><br>
</div>
<div class="colorSelection">
<label>Please pick a color:</label> <br>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This label isn't attached to any control, it's just acting as a heading for the group. Which element does the MDN page from the prep use to group a set of radio buttons and give them a caption? Same for line 50.

<div class="colorOption">
<label for="blueOption">Blue</label>
<div class="square" id="blueOptions">
<input type="radio" name="color" id="blueOption" value="blue">
</div>
</div>
<div class="colorOption">
<label for="greenOption">Green</label>
<div class="square" id="greenOptions">
<input type="radio" name="color" id="greenOption"value="green">

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Missing space between id="greenOption" and value="green". This is the one error the HTML validator (https://validator.w3.org/, from the README checklist) reports. The formatter will fix it.

</div>
</div>
<div class="colorOption">
<label for="redOption">Red</label>
<div class="square" id="redOptions">
<input type="radio" name="color" id="redOption" value="red" required>
</div>
</div>
</div>
<div id="sizediv">
<label>Please select the t-shirt size:</label> <br> .

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

There's a stray . after the <br> here and it shows on the page.

<div class="colorSelection">
<div class="sizeOption">
<label for="xs">XS</label>
<div>
<input type="radio" name="size" value="xs" id="xs">

@abdishakoor-dev abdishakoor-dev Sep 14, 2026

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pick no size and submit: the form goes through. You've already solved this for colour on line 45. What's different about these six?

</div>
</div>
<div class="sizeOption">
<label for="s">S</label>
<div>
<input type="radio" name="size" id="s" value="s">
</div>
</div>
<div class="sizeOption">
<label for="m">M</label>
<div>
<input type="radio" name="size" id="m" value="m">
</div>
</div>
<div class="sizeOption">
<label for="l">L</label>
<div>
<input type="radio" id="l" name="size" value="l">
</div>
</div>
<div class="sizeOption">
<label for="xl">XL</label>
<div>
<input type="radio" id="xl" name="size" value="xl">
</div>
</div>
<div class="sizeOption">
<label for="sizexxl">XXL</label>
<div>
<input type="radio" id ="sizexxl" name="size" value="xxl">
</div>
</div>
</div>
</div>
</form>

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

The form closes here with no submit button. Open the deploy preview and try to send the form. What's missing, and what does the browser do with required and pattern until it's there?

</main>

<footer>
<p>By Abdennour Hachemi</p>
</footer>
</body>

</html>
39 changes: 39 additions & 0 deletions Form-Controls/styles.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@

.colorSelection {
display: flex;
gap: 20px;
margin-left: 20px;
margin-top: 20px;
}

.colorOption {
display: flex;
flex-direction: column;
align-items:center;
}

.square {
height: 25px;
width: 25px;
}

#blueOptions {
background-color: #180fcb;
}

#greenOptions {
background-color: green;
}

#redOptions {
background-color: red;
}

#sizediv{
margin:20px 20px;

}

#fn,#sn,#em{
margin: 20px 20px;
}
Loading