Skip to content
Open
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
82 changes: 75 additions & 7 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<head>
<meta charset="utf-8" />
<meta http-equiv="X-UA-Compatible" content="IE=edge" />
<title>My form exercise</title>
<title>My form control exercise</title>
<meta name="description" content="" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>
Expand All @@ -13,15 +13,83 @@ <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-->
<!-- Customer Information -->
<fieldset>
<legend>Customer Information</legend>

<label for="first_name">First Name:</label><br />
<input type="text" id="first_name" name="first_name" required minlength="2" /><br /><br />
Copy link
Contributor

Choose a reason for hiding this comment

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

Currently a user can enter a name consisting of only space characters (e.g., " "). Can you enforce a stricter validation rule using the pattern attribute to disallow any name that contains only space characters?


<label for="last_name">Last Name:</label><br />
<input type="text" id="last_name" name="last_name" required minlength="2" /><br /><br />

<label for="email">Email:</label><br />
<input type="email" id="email" name="email" required /><br /><br />
</fieldset>

<br />

<!-- Product Information -->
<fieldset>
<legend>Product Information</legend>

<!-- T-shirt Color -->
<div>
T-shirt Color:<br /><br />
<label>
<input type="radio" name="color" value="red" required />
&nbsp;&nbsp;Red&nbsp;&nbsp;
</label>
<label>
<input type="radio" name="color" value="blue" required />
&nbsp;&nbsp;Blue&nbsp;&nbsp;
</label>
<label>
<input type="radio" name="color" value="green" required />
&nbsp;&nbsp;Green&nbsp;&nbsp;
</label><br /><br />
</div>
Comment on lines +39 to +51
Copy link
Contributor

Choose a reason for hiding this comment

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

Since these three radio buttons belong to the same button group (share the same name value), we don't need required in all input elements; one is enough.


<!-- T-shirt Size -->
<div>
T-shirt Size:<br /><br />
<label>
<input type="radio" name="size" value="XS" required />
&nbsp;&nbsp;XS&nbsp;&nbsp;
</label><br /><br />
<label>
<input type="radio" name="size" value="S" required />
&nbsp;&nbsp;S&nbsp;&nbsp;
</label><br /><br />
<label>
<input type="radio" name="size" value="M" required />
&nbsp;&nbsp;M&nbsp;&nbsp;
</label><br /><br />
<label>
<input type="radio" name="size" value="L" required />
&nbsp;&nbsp;L&nbsp;&nbsp;
</label><br /><br />
<label>
<input type="radio" name="size" value="XL" required />
&nbsp;&nbsp;XL&nbsp;&nbsp;
</label><br /><br />
<label>
<input type="radio" name="size" value="XXL" required />
&nbsp;&nbsp;XXL&nbsp;&nbsp;
</label><br /><br />
</div>
</fieldset>

<br />

<!-- Buttons -->
<button type="reset">&nbsp;&nbsp;Reset&nbsp;&nbsp;</button>
<button type="submit">&nbsp;&nbsp;Submit&nbsp;&nbsp;</button>
</form>
</main>

<footer>
<!-- change to your name-->
<h2>By HOMEWORK SOLUTION</h2>
<h2>By Adnaan Abo</h2>
</footer>
</body>
</html>
Loading