Skip to content

GLASGOW | ITP_MAY-25 | VALENTYN_PRONCHENKO | FORM_CONTROLS #703

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
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
85 changes: 78 additions & 7 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,87 @@
<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-->
<h2>Confirm Your Identity</h2>
<form id="order-form" action="submit.html" method="get">
<div>
<label for="name"
>Full Name:<span aria-label="required">*</span></label
>
<input
type="text"
id="name"
name="name"
required
minlength="2"
pattern="^[A-Za-z\s'-]{2,50}$"
title="Please enter a valid name (letters, spaces, hyphens, and apostrophes only)"
placeholder="Your full name"
autocomplete="name"
/>
</div>

<div>
<label for="email"
>Email address:<span aria-label="required">*</span></label
>
<input
type="email"
id="email"
name="email"
required
pattern="^[^\s@]+@[^\s@]+\.[^\s@]{2,}$"
title="Please enter a valid email address"
placeholder="[email protected]"
autocomplete="email"
/>
</div>

<h2>Select Your T-Shirt Options</h2>

<div>
<label for="color">Colour:</label>
<select id="color" name="color" required>
<option value="" disabled selected>Select colour</option>
<option value="white">White</option>
<option value="black">Black</option>
<option value="red">Red</option>
</select>
</div>

<div>
<label for="size">Size:</label>
<select id="size" name="size" multiple required>
<option value="" disabled selected>Select size</option>
<option value="S">Extra Small (XS)</option>
<option value="S">Small (S)</option>
<option value="M">Medium (M)</option>
<option value="L">Large (L)</option>
<option value="XL">Extra Large (XL)</option>
<option value="XXL">Double Extra Large (XXL)</option>
</select>
Comment on lines +63 to +72
Copy link
Contributor

Choose a reason for hiding this comment

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

With this input elements, a user can select any number of sizes. It does not quite satisfy the requirement "I require one size from a defined set of 6 sizes."

</div>
<div>
<label for="male">Male</label>
<input type="radio" name="gender" id="male" value="male" />
</div>
<div>
<label for="female">Female</label>
<input type="radio" name="gender" id="female" value="female" />
</div>
<div>
<label for="specialRequest">Special Request</label>
<textarea
name="specialRequest"
id="specialRequest"
placeholder="write your request here and we will contact you"
></textarea>
</div>
<button type="reset">Reset</button>
<button type="submit">Place Order</button>
</form>
</main>
<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
<h3>By Valentyn Pronchenko</h3>
</footer>
</body>
</html>
19 changes: 19 additions & 0 deletions Form-Controls/submit.html
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1.0" />
<title>Submit</title>
</head>
<body>
<div id="submit"></div>
<a href="/Form-Controls/">Back to Form</a>
<script>
const submitList = document.getElementById("submit");
new URLSearchParams(window.location.search).forEach((value, name) => {
submitList.append(`${name}: ${value}`);
submitList.append(document.createElement("br"));
});
</script>
</body>
</html>