Skip to content
89 changes: 64 additions & 25 deletions Form-Controls/index.html
Original file line number Diff line number Diff line change
@@ -1,27 +1,66 @@
<!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-->
<h2>By HOMEWORK SOLUTION</h2>
</footer>
</body>
</html>
<head>
<meta charset="utf-8" />
<title>My form exercise</title>
<meta name="viewport" content="width=device-width, initial-scale=1" />
</head>

<body>
<header>
<h1>Product Pick</h1>
</header>

<main>
<form>

<p>
<label for="name">Name</label>
<input type="text" id="name" name="user_name"
placeholder="John Smith"
required minlength="2" maxlength="18">
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

Do we want maxlength on name / email address? Could a name be longer than 18 characters, or an email longer than 32 characters?

</p>

<p>
<label for="email">Email</label>
<input type="email" id="email" name="user_email"
placeholder="johnsmith@hotmail.com"
required minlength="5" maxlength="32">
</p>

<p>Colour</p>

<input type="radio" id="red" name="colour" value="red" required>
<label for="red">Red</label><br>

<input type="radio" id="blue" name="colour" value="blue">
<label for="blue">Blue</label><br>

<input type="radio" id="green" name="colour" value="green">
<label for="green">Green</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.

well done for the good work.
just a few more things to do
can we use a dropdown menu () for the sizes ? when should you use radio buttons and drop down menu ()
see https://developer.mozilla.org/en-US/docs/Web/HTML/Reference/Elements/select

<p>
<label for="size">Size</label>
<select id="size" name="size" 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>
Copy link
Copy Markdown

Choose a reason for hiding this comment

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

There is a small error that comes up when I validate this HTML. Can you check what's showing & try and fix it?

https://validator.w3.org/nu/#textarea

</p>

<p>
<button type="submit">Submit</button>
</p>

Copy link
Copy Markdown

Choose a reason for hiding this comment

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

How do we submit the form? is there an element to use to submit the form ?

</form>
</main>

<footer>
<h2>By LIBAN JAMA</h2>
</footer>

</body>
</html>