-
-
Notifications
You must be signed in to change notification settings - Fork 418
London | 26-ITP-January | Carlos Abreu | Sprint 2 | Form Controls #1155
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
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 |
|---|---|---|
| @@ -1,27 +1,104 @@ | ||
| <!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> | ||
| <head> | ||
| <meta charset="UTF-8"> | ||
| <meta name="viewport" content="width=device-width, initial-scale=1.0"> | ||
| <title>T-Shirt Order Form</title> | ||
| </head> | ||
| <body> | ||
| <header> | ||
| <h1>Product Pick</h1> | ||
| <h1>T-Shirt Order Form</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> | ||
| <section> | ||
| <h2>Order Your T-Shirt</h2> | ||
| <p>Please verify your identity and select your t-shirt preferences.</p> | ||
|
|
||
| <form id="tshirt-order-form"> | ||
| <fieldset> | ||
| <legend>Customer Verification</legend> | ||
|
|
||
| <div> | ||
| <label for="customer-name">Name</label> | ||
| <input type="text" | ||
| id="customer-name" | ||
| name="customer-name" | ||
| required | ||
| minlength="2" | ||
| placeholder="Enter first and last name"> | ||
| <p><small>Must be at least 2 characters long</small></p> | ||
| </div> | ||
|
|
||
| <div> | ||
| <label for="customer-email">Email Address</label> | ||
| <input type="email" | ||
| id="customer-email" | ||
| name="customer-email" | ||
| required | ||
| placeholder="example@domain.com"> | ||
|
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. Can you also think of another way to verify if the customer email is a valid email?
Author
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. Using multiple attributes for comprehensive validation Email Address We'll use this to verify your email format (6-254 characters) |
||
| <p><small>We'll use this to verify your account</small></p> | ||
| </div> | ||
| </fieldset> | ||
|
|
||
| <fieldset> | ||
| <legend>T-Shirt Customization</legend> | ||
|
|
||
| <div> | ||
| <p>Select T-Shirt Colour</p> | ||
| <div> | ||
| <input type="radio" | ||
| id="colour-red" | ||
| name="tshirt-colour" | ||
| value="red" | ||
| required> | ||
| <label for="colour-red">Red</label> | ||
| </div> | ||
| <div> | ||
| <input type="radio" | ||
| id="colour-blue" | ||
| name="tshirt-colour" | ||
| value="blue" | ||
| required> | ||
| <label for="colour-blue">Blue</label> | ||
| </div> | ||
| <div> | ||
| <input type="radio" | ||
| id="colour-green" | ||
| name="tshirt-colour" | ||
| value="green" | ||
| required> | ||
| <label for="colour-green">Green</label> | ||
| </div> | ||
| </div> | ||
|
|
||
| <div> | ||
| <label for="tshirt-size">Select T-Shirt Size</label> | ||
| <select id="tshirt-size" | ||
| name="tshirt-size" | ||
| required> | ||
| <option value="" disabled selected>Choose a size</option> | ||
| <option value="xs">XS (Extra Small)</option> | ||
| <option value="s">S (Small)</option> | ||
| <option value="m">M (Medium)</option> | ||
| <option value="l">L (Large)</option> | ||
| <option value="xl">XL (Extra Large)</option> | ||
| <option value="xxl">XXL (Double Extra Large)</option> | ||
| </select> | ||
| <p><small>All sizes are unisex</small></p> | ||
| </div> | ||
| </fieldset> | ||
|
|
||
| <div> | ||
| <button type="submit">Submit Order</button> | ||
| <button type="reset">Clear Form</button> | ||
| </div> | ||
| </form> | ||
| </section> | ||
| </main> | ||
|
|
||
| <footer> | ||
| <!-- change to your name--> | ||
| <p>By HOMEWORK SOLUTION</p> | ||
| <p>© 2026 - Carlos Abreu Shirt Store. All rights reserved.</p> | ||
| </footer> | ||
| </body> | ||
| </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.
Can you think of another way to verify if the customer name is a valid name
Uh oh!
There was an error while loading. Please reload this page.
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.
Certainly!
Here is one alternative approaches to validating a customer name in HTML form controls:
Using pattern attribute with regex
This allows for more specific validation patterns:
Name
Must be at least 2 characters long
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.
Yes, do that.