-
-
Notifications
You must be signed in to change notification settings - Fork 492
Birmingham | 25-ITP-May | Tobias Amaechina|Sprint 1|Form control #1324
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
base: main
Are you sure you want to change the base?
Changes from all commits
8ce5a1a
6f1279a
7d5b6cd
c0d5aa2
c93d2a7
2587fb8
7b3e78e
790019b
3202a19
ec3f16d
5e7ec28
919fac9
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -6,22 +6,136 @@ | |
| <title>My form exercise</title> | ||
| <meta name="description" content="" /> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1" /> | ||
| <style> | ||
| body { | ||
| font-family: system-ui, sans-serif; | ||
| padding: 1rem; | ||
| line-height: 1.5; | ||
| } | ||
| form { | ||
| max-width: 500px; | ||
| margin: auto; | ||
| } | ||
| fieldset { | ||
| border: none; | ||
| padding: 0; | ||
| margin: 1.5rem; | ||
| } | ||
| label { | ||
| display: block; | ||
| margin-bottom: 0.5rem; | ||
| font-weight: 600; | ||
| } | ||
| input, select button{ | ||
| width: 100%; | ||
| padding:12px; | ||
| font-size: 1rem; | ||
| min-height: 48px; | ||
| box-sizing: border-box; | ||
| } | ||
| small { | ||
| display: block; | ||
| margin-top: 0.25rem; | ||
| color: #666; | ||
| } | ||
| button { | ||
| padding: 0.75rem 1.5rem; | ||
| font-size: 1rem; | ||
| background-color: #007BFF; | ||
| color: white; | ||
| border: none; | ||
| cursor: pointer; | ||
| } | ||
| button:hover { | ||
| background-color: #0056b3; | ||
| } | ||
| header, footer { | ||
| text-align: center; | ||
| margin-bottom: 2rem; | ||
| } | ||
| footer p { | ||
| font-size: 0.875rem; | ||
| color: #666; | ||
| } | ||
|
|
||
| </style> | ||
| </head> | ||
| <body> | ||
| <header> | ||
| <h1>Product Pick</h1> | ||
| </header> | ||
| <main> | ||
| <form> | ||
| <!-- write your html here--> | ||
| <!-- | ||
| <!-- First name--> | ||
| <fieldset> | ||
| <label for = "first-name">First Name</label> | ||
| <input type="text" id="first-name" name="first-name" required pattern=".*\S.*\S.*" | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Good job on the validation. This works well |
||
| aria-describedby="fnameHelp"> | ||
| <small id="fnameHelp">Must be at least 2 characters long</small> | ||
| </fieldset> | ||
| <!-- Last name--> | ||
| <fieldset> | ||
| <label for = "last-name">Last Name</label> | ||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Why are there spaces bet ween the html attirbute and its value? |
||
| <input type="text" id="last-name" name="last-name" required pattern=".*\S.*\S.*" | ||
| aria-describedby="lnameHelp"> | ||
| <small id="lnameHelp">Must be at least 2 characters long</small> | ||
| </fieldset> | ||
| <!-- Email--> | ||
| <fieldset> | ||
| <label for = "email">Email</label> | ||
| <input type="email" id="email" name="email" required pattern="[a-z0-9._%+-]+@[a-z0-9.-]+\.[a-z]{2,}$" | ||
| aria-describedby="emailHelp"> | ||
|
Comment on lines
+86
to
+87
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I find the code hard to read because of the formatting (long lines). How can you ensure consistent formatting in your code? |
||
| <small id="emailHelp">Must be a valid email address</small> | ||
| </fieldset> | ||
| <!-- Password--> | ||
| <fieldset> | ||
| <label for = "password">Password</label> | ||
| <input type="password" id="password" name="password" required pattern="^(?=.*[a-z])(?=.*[A-Z])(?=.*\d)(?=.*[@$!%*?&])[A-Za-z\d@$!%*?&]{8,}$" | ||
| aria-describedby="passwordHelp"> | ||
| <small id="passwordHelp">Must be at least 8 characters long and include at least one uppercase letter, one lowercase letter, one number, and one special character</small> | ||
| </fieldset> | ||
| <!--Shirt Color--> | ||
| <fieldset> | ||
| <legend>Shirt Color</legend> | ||
| <label for = "shirt-color">Shirt Color</label> | ||
| <select id="shirt-color" name="shirt-color" required> | ||
| <option value="">Select a color</option> | ||
| <option value="red">Red</option> | ||
| <option value="blue">Blue</option> | ||
| <option value="green">Green</option> | ||
| </select> | ||
| </fieldset> | ||
| <!---Shirt Size--> | ||
| <fieldset> | ||
| <label for = "shirt-size">Shirt Size</label> | ||
| <select id="shirt-size" name="shirt-size" required> | ||
| <option value="">Select 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> | ||
| </fieldset> | ||
|
|
||
| <!--Submit button--> | ||
| <fieldset> | ||
| <button type="submit">Submit Form </button> | ||
| </fieldset> | ||
|
|
||
| <!-- | ||
| What is the customer's name? I must collect this data and ensure it contains at least two non-space characters. | ||
| What is the customer's email? I must make sure the email is valid. Email addresses follow a consistent pattern. | ||
| What colour should this T-shirt be? I must provide 3 options. How will I ensure they do not choose other colours? | ||
| What size does the customer want? I must provide the following 6 options: XS, S, M, L, XL, XXL | ||
| 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--> | ||
| <p>By HOMEWORK SOLUTION</p> | ||
| <p>By Tobias Amaechina</p> | ||
| </footer> | ||
| </body> | ||
| </html> | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
How could you seperate the code for the styling from the html to make it easier to review (because of smaller files with seperate responsibilites)