Skip to content
Closed
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
2 changes: 1 addition & 1 deletion Form-Controls/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Writing that out as a series of questions to ask yourself:
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

All fields are required.
All fields are required.
Do not write a form action for this project.

## Acceptance Criteria
Expand Down
58 changes: 52 additions & 6 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,73 @@
<!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" />
<link rel = "stylesheet" href = "style.css">
</head>

<body>

<header>
<h1>Product Pick</h1>
</header>
<main>
<form>

<form method = "get" class = "form-container">

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Is there a reason you put spaces between the attribute and the value?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

There is no real reason aside from just muscle memory when I type.

<!-- write your html here-->
<!--
try writing out the requirements first as comments
this will also help you fill in your PR message later-->

<!-- All inputs are required and are labelled for accessibility and have corresponding name, for, and id attributes -->
<!-- Asks for their forename name -->
<label for = "forename"> Forename:</label>
<input type = "text" name = "forename" id="forename" minlength="2" required>
<br>

<!-- Asks for their surname -->
<label for = "surname"> Surname: </label>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Be careful about requiring both a forename and a surname. Not all people have 2 names, and some have many more.

If you check the Readme it only asks for a "name" - how could you change the form to match this?

Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

I could ask for a full name instead of a forename and surname

<input type = "text" name = "surname" id="surname" minlength="2" required>
<br>

<!-- Asks for their email -->
<label for = "email"> Email: </label>
<input type = "email" name = "email" id="email" required>
<br>

<!-- Gives them the options to choose between 3 colours -->
<label for ="colour"> T-shirt Colour: </label>
<select name = "colour" id = "colour" required>
<option value = "" selected disabled>Choose a colour</option>
<option value = "white">White</option>
<option value = "black">Black</option>
<option value = "grey">Grey</option>
</select>
<br>

<!-- Gives them the option to choose between 6 sizes-->
<label for="size"> T-shirt Size:</label>
<select name = "size" id = "size" required>
<option value = "" selected disabled>Choose a size</option>
<option value = "xs">XS</option>
<option value = "s">S</option>
<option value = "m">M</option>
<option value = "l">L</option>
<option value = "xl">XL</option>
<option value = "xxl">XXL</option>
</select>
<br>

<!-- Submit button -->
<button type ="submit">Submit</button>

</form>
</main>

<footer>
<!-- change to your name-->
<p>By HOMEWORK SOLUTION</p>
<p>By Muhammad-Burhan Mustafa</p>
</footer>

</body>
</html>
41 changes: 41 additions & 0 deletions Form-Controls/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
/* Creates a container for the form that is also centered*/

.form-container{
display: flex;
flex-direction: column;
border-style:solid;
padding: 10px;
max-width:400px;
margin:auto;
font-size: 28px;
}

/* Ensures that inputs and options are standard size and centered*/
.form-container input,
.form-container option{
font-size: 24px;
width:100%;
max-width: 325px;
box-sizing: border-box;
margin-left:auto;
margin-right:auto;
}

/* Ensures that select and buttons are a standard size and centered*/
.form-container select,
.form-container button{
max-width:325px;
width: 100%;
box-sizing: border-box;
margin-left:auto;
margin-right:auto;
font-size: 24px;
}

h1{
text-align: center;
}

footer{
text-align: center;
}
Loading