-
Notifications
You must be signed in to change notification settings - Fork 608
html-form #798
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: master
Are you sure you want to change the base?
html-form #798
Changes from 2 commits
22d3147
507605a
74e2d31
72c24ef
8c89f09
32231db
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 | ||||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -10,8 +10,194 @@ | |||||||||||||||
| <title>HTML Form</title> | ||||||||||||||||
| <link rel="stylesheet" href="./style.css"> | ||||||||||||||||
| </head> | ||||||||||||||||
|
|
||||||||||||||||
| <body> | ||||||||||||||||
| <h1>HTML Form</h1> | ||||||||||||||||
| <script type="text/javascript" src="./main.js"></script> | ||||||||||||||||
|
|
||||||||||||||||
| <form action="https://mate-academy-form-lesson.herokuapp.com/create-application" method="post" | ||||||||||||||||
| class="form"> | ||||||||||||||||
| <fieldset class="form__group"> | ||||||||||||||||
| <legend>Personal information</legend> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
|
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 assume you are using this div to wrap all elements in a block elements so it takes the whole available horizontal space, there is no need for that if you already wrap your label and input in label element. Remove this div 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. Also there should be an empty line between surname and input 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. It should look like this: <label class="form__field">
Surname:
<input
type="text"
name="surname"
autocomplete="off"
>
</label>
<label class="form__field">
Name:
<input
type="text"
name="name"
autocomplete="off"
>Adjust rest of you elements and remove unnecessary divs 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. Also consider
You may see this result in network tab after submitting your form, input's that didn't have names are not submitted
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.
Hello Radoslaw, if i remove this divs then i'll have elements inline. How handle it? 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. Just add to your |
||||||||||||||||
| <label> | ||||||||||||||||
| Surname: | ||||||||||||||||
| <input | ||||||||||||||||
| type="text" | ||||||||||||||||
|
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. Add a 'name' attribute to the input field for 'Surname'. Example: name="surname" |
||||||||||||||||
| autocomplete="off" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| Name: | ||||||||||||||||
| <input | ||||||||||||||||
|
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. Add a 'name' attribute to the input field for 'Name'. Example: name="name" |
||||||||||||||||
| type="text" | ||||||||||||||||
| autocomplete="off" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| How old are You? | ||||||||||||||||
| <input | ||||||||||||||||
| type="number" | ||||||||||||||||
|
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. Change the 'name' attribute value to a more descriptive name for the age input field. Example: name="age" |
||||||||||||||||
| name="number" | ||||||||||||||||
| min="1" max="100" | ||||||||||||||||
| value="12" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| Full date of birth: | ||||||||||||||||
| <input | ||||||||||||||||
| type="date" | ||||||||||||||||
|
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. Add a 'name' attribute to the input field for 'Full date of birth'. Example: name="birthdate" |
||||||||||||||||
| name="date" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div> | ||||||||||||||||
| <label> | ||||||||||||||||
| I accept the term of the agreement | ||||||||||||||||
| <input | ||||||||||||||||
| type="checkbox" | ||||||||||||||||
| name="agreement" | ||||||||||||||||
| required | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
| </fieldset> | ||||||||||||||||
|
|
||||||||||||||||
| <fieldset class="form__group"> | ||||||||||||||||
| <legend>Registration</legend> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| E-mail: | ||||||||||||||||
| <input | ||||||||||||||||
| type="email" | ||||||||||||||||
| name="email" | ||||||||||||||||
| placeholder="email@example.com" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div> | ||||||||||||||||
|
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. Same question here |
||||||||||||||||
| <label> | ||||||||||||||||
| Password: | ||||||||||||||||
| <input | ||||||||||||||||
| type="password" | ||||||||||||||||
| name="password" | ||||||||||||||||
| autocomplete="off" | ||||||||||||||||
| required minlength="5" | ||||||||||||||||
|
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. All attributes here should be on separate lines |
||||||||||||||||
| maxlength="15" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
| </fieldset> | ||||||||||||||||
|
|
||||||||||||||||
| <fieldset class="form__group"> | ||||||||||||||||
| <legend>An interesting fact about you!</legend> | ||||||||||||||||
|
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. As stated in the previous review all siblings should have an empty line between them apart from some specials situations with repeated tags: <fieldset class="form__group">
<legend>An interesting fact about you!</legend>
<div class="form__field">
<span>Do you love cats?</span>
<label for="love">Yes</label>
<input
type="radio"
id="love"
name="cats"
value="yes"
>
<label for="hate">No</label>
<input
type="radio"
id="hate"
name="cats"
value="no"
>
</div>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. Also see that I have wrapped you |
||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| Do you love cats? | ||||||||||||||||
| <input | ||||||||||||||||
| type="radio" | ||||||||||||||||
| id="love" | ||||||||||||||||
| name="cats" | ||||||||||||||||
| value="yes" | ||||||||||||||||
| > | ||||||||||||||||
| <label for="love">Yes</label> | ||||||||||||||||
|
|
||||||||||||||||
| <input | ||||||||||||||||
| type="radio" | ||||||||||||||||
| id="hate" | ||||||||||||||||
| name="cats" | ||||||||||||||||
| value="no" | ||||||||||||||||
| > | ||||||||||||||||
| <label for="hate">No</label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| What is your favorite color? | ||||||||||||||||
| <input | ||||||||||||||||
| type="color" | ||||||||||||||||
| name="color" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| What time do you go to bed? | ||||||||||||||||
| <input | ||||||||||||||||
| type="time" | ||||||||||||||||
| name="time" | ||||||||||||||||
| > | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label for="brandPicker">What are your favorite brand of cars?</label> | ||||||||||||||||
|
|
||||||||||||||||
| <select id="brandPicker" name="cars" | ||||||||||||||||
|
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. Formatting here is wrong, see how it's done for example on you inputs 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. You should fix formatting here as Radek mentioned
Suggested change
|
||||||||||||||||
| required multiple> | ||||||||||||||||
| <option value="bmw">BMW</option> | ||||||||||||||||
|
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 options shouln't have empty lines between them as they are repetitions of the same tag |
||||||||||||||||
|
|
||||||||||||||||
| <option value="audi">Audi</option> | ||||||||||||||||
|
|
||||||||||||||||
| <option value="lada">Lada</option> | ||||||||||||||||
|
|
||||||||||||||||
| <option value=" " disabled> </option> | ||||||||||||||||
|
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. There is no need for this empty option, remove it |
||||||||||||||||
| </select> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div> | ||||||||||||||||
| How do you rate our work? | ||||||||||||||||
|
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. This should be a label for the below input |
||||||||||||||||
| <input | ||||||||||||||||
| type="range" | ||||||||||||||||
| name="range" | ||||||||||||||||
| min="1" | ||||||||||||||||
| max="100" | ||||||||||||||||
| > | ||||||||||||||||
| </div> | ||||||||||||||||
| </fieldset> | ||||||||||||||||
|
|
||||||||||||||||
| <fieldset class="form__group"> | ||||||||||||||||
| <legend>Additional info:</legend> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form__field"> | ||||||||||||||||
| <label> | ||||||||||||||||
| Comments: | ||||||||||||||||
| <textarea id="comments" name="comments"></textarea> | ||||||||||||||||
| </label> | ||||||||||||||||
| </div> | ||||||||||||||||
|
|
||||||||||||||||
| <div> | ||||||||||||||||
| Would you recommend us? | ||||||||||||||||
| <select name="recommend"> | ||||||||||||||||
| <option value="recommend" | ||||||||||||||||
| disabled> | ||||||||||||||||
| </option> | ||||||||||||||||
|
|
||||||||||||||||
| <option value="yes" | ||||||||||||||||
|
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. Wrong formatting, adjust similarly to how attributes are spaced on you inputs, also you don't need empty lines between options as these are same tags |
||||||||||||||||
| selected>yes | ||||||||||||||||
| </option> | ||||||||||||||||
|
|
||||||||||||||||
| <option value="no">no</option> | ||||||||||||||||
| </select> | ||||||||||||||||
| </div> | ||||||||||||||||
| </fieldset> | ||||||||||||||||
|
|
||||||||||||||||
| <div class="form-submit"> | ||||||||||||||||
|
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. There is no need for this button to be wrapped in div |
||||||||||||||||
| <button type="submit">Submit</button> | ||||||||||||||||
| </div> | ||||||||||||||||
| </form> | ||||||||||||||||
| </body> | ||||||||||||||||
| </html> | ||||||||||||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,9 @@ | ||
| /* styles go here */ | ||
|
|
||
| .form__group { | ||
| margin-bottom: 20px; | ||
| } | ||
|
|
||
| .form__field { | ||
| box-sizing: border-box; | ||
| margin-bottom: 10px; | ||
| } |

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.
Generally you don't have any empty lines between elements making this code very hard to read, for example you should always have empty line between siblings:
there is an exception to this rule, for example when you have a bunch of similar elements like in ul