Skip to content
Open
Show file tree
Hide file tree
Changes from 2 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
48 changes: 43 additions & 5 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,49 @@
<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 action="order" method="post">

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 task says "Do not write a form action for this project". What happens on the deploy preview when you fill the form in correctly and press Place Order?

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.

Action gone. One thing left on this line, see the new comment.

<div>
<label for="CustomerName">Customer Name:</label>
<input type="text" id="CustomerName" name="CustomerName" required>

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.

required only stops the field being empty. Type two spaces and it passes. The README gives you a regex for "at least two non-space characters". Which attribute does it go in?

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.

Fixed, and two spaces are rejected now. Good.

</div>
<div>
<label for="CustomerNumber">Customer Number:</label>
<input type="number" id="CustomerNumber" name="CustomerNumber" required>

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.

Where in the task is a customer number asked for? Every extra required field is one more thing the customer has to get right before they can order.

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.

Removed, good.

</div>
<div>
<label for="CustomerEmail">Customer Email:</label>
<input
type="email"
id="CustomerEmail"
name="CustomerEmail"
required
pattern="[a-zA-Z0-9._%+-]+@[a-zA-Z0-9.-]+\.[a-zA-Z]{2,}"
title="Enter an email address such as name@example.com"
>
</div>
<div>
<label for="T-ShirtsColor">T-Shirt Color:</label>
<select id="T-ShirtsColor" name="T-ShirtsColor" required>
<option value="Red">Red</option>

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.

Red is selected as soon as the page loads, so required has nothing to check. Read the validator's message for this line. What does it say the first option needs? Same for the size select on line 46.

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.

Both dropdowns fixed. Good.

<option value="Blue">Blue</option>
<option value="Green">Green</option>
</select>
</div>
<div>
<label for="T-ShirtsSize">T-Shirt Size:</label>
<select id="T-ShirtsSize" name="T-ShirtsSize" required>
<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>
</div>
</div>

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.

Which <div> is this closing? Count the opening and closing divs above it.

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.

Fixed.

<div>
<button type="submit">Place Order</button>
</div>
</form>
</main>
<footer>
Expand Down
23 changes: 23 additions & 0 deletions Form-Controls/style.css
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@

form > div {
margin-bottom: 1em;
}

label {
font-weight: bold;
}

button {
background-color: #4CAF50;
color: black;
font-weight: bold;
padding: 10px 20px;
border: none;
border-radius: 4px;
cursor: pointer;
}

button:hover {
background-color: #45a049;
}

Loading