-
-
Notifications
You must be signed in to change notification settings - Fork 542
London | 26-ITP-Sep | Mahir Shah | Sprint 1 | Form Controls #1495
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
e2e61e3
e79de37
7c61a35
7803f17
9a71def
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,4 +1,4 @@ | ||
| <!DOCTYPE html> | ||
| <!doctype html> | ||
| <html lang="en"> | ||
| <head> | ||
| <meta charset="utf-8" /> | ||
|
|
@@ -13,15 +13,62 @@ <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--> | ||
| <div> | ||
| <label for="name">Name:</label> | ||
| <input | ||
| type="text" | ||
| id="name" | ||
| name="name" | ||
| required | ||
| minlength="2" | ||
| pattern="(\p{L}\p{M}*)+(['\- ](\p{L}\p{M}*)+)*" | ||
| /> | ||
| <!--Regex. \p{L} Any unicode | ||
| character considered a letter. \p{M}* 0 or more unicode character that | ||
| could have accent. ()+ 1 or more of all of that. | ||
| ['\- ] 1 space ' - character. (\p{L}\p{M}*)+)* then | ||
| 0 or more of any letter again --> | ||
| </div> | ||
| <br /> | ||
|
Contributor
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. These
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 CSS with margins
Contributor
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. Yes. Margins in CSS, whenever you next style a form. |
||
| <div> | ||
| <label for="email">Email:</label> | ||
| <input | ||
| type="email" | ||
| id="email" | ||
| name="email" | ||
| required | ||
| placeholder="abc@example.com" | ||
| /> | ||
| </div> | ||
| <br /> | ||
| <div> | ||
| <label for="colour">Colour</label> | ||
| <select name="colour" id="colour" required> | ||
| <option value="">Please select</option> | ||
|
Contributor
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. Starting the dropdown on an empty "Please select" option is the right way to make |
||
| <option value="white">White</option> | ||
| <option value="black">Black</option> | ||
| <option value="green">Green</option> | ||
| </select> | ||
| </div> | ||
| <br /> | ||
| <div> | ||
| <label for="size">Size</label> | ||
| <select name="size" id="size" required> | ||
| <option value="">Please select</option> | ||
| <option value="xs">Extra Small</option> | ||
| <option value="s">Small</option> | ||
| <option value="m">Medium</option> | ||
| <option value="l">Large</option> | ||
| <option value="xl">Extra Large</option> | ||
| <option value="xxl">Extra Extra Large</option> | ||
| </select> | ||
| </div> | ||
| <br> | ||
| <button>Submit</button> | ||
| </form> | ||
|
Contributor
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. The form ends here without any button. Try filling it in on the deploy preview and submitting. What happens? Which element would let the user do that, and would the browser then run the validation you've written?
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. Nothing happens because I haven't added a button. Adding the button, then when clicking it the browser validates the inputs
Contributor
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. That's it. The button is what lets the browser run the checks you'd written. |
||
| </main> | ||
| <footer> | ||
| <!-- change to your name--> | ||
| <p>By HOMEWORK SOLUTION</p> | ||
| <p>By Mahir Shah</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.
Good pattern. I tried
Är,ää,O'Brien,Anne-Marieand李明and they all pass, whileandAare rejected. One question: what doesminlength="2"add that the pattern doesn't already do on its own?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.
The pattern accepts single characters and the requirement is at least 2 non space characters, which is why I used the min length
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.
Good answer. The pattern controls which characters, minlength controls how many. Both are needed.