-
Notifications
You must be signed in to change notification settings - Fork 625
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
html-form #798
base: master
Are you sure you want to change the base?
html-form #798
Conversation
DominikaKarmel
commented
Jun 1, 2023
- DEMO LINK
- TEST REPORT LINK
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.
Left a few comments also:
- again take a look at the task requirements and implement accordingly
- there are a lot of indent and style errors adjust according to comments / checklist
- don't use div's for everything try to use more semantic html (appropriate tags)
src/index.html
Outdated
<script type="text/javascript" src="./main.js"></script> | ||
<form action="http://localhost:8080/api" method="post" |
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.
action according to requirements should be https://mate-academy-form-lesson.herokuapp.com/create-application
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.
Also formatting is wrong, adjust according to the checklist p. 4
<script type="text/javascript" src="./main.js"></script> | ||
<form action="http://localhost:8080/api" method="post" | ||
class="form"> | ||
<fieldset class="form__group"> |
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:
<div>
<span>first child</span>
<p>second child</p>
</div>
there is an exception to this rule, for example when you have a bunch of similar elements like in ul
<ul>
<li>text</li>
<li>text</li>
<li>text</li>
<li>text</li>
</ul>
> | ||
</div> | ||
<div class="form-field"> | ||
Name: |
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.
Such text should be a label for appropriate input so upon clicking on it correct field is focused
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.
Left a few comments, don't adjust only the places comments are placed but based on them correctly format rest of your code, you have a lot of unnecessary divs and some wrong formatting
src/index.html
Outdated
</div> | ||
</fieldset> | ||
|
||
<div class="form-submit"> |
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.
There is no need for this button to be wrapped in div
src/index.html
Outdated
type="password" | ||
name="password" | ||
autocomplete="off" | ||
required minlength="5" |
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.
All attributes here should be on separate lines
src/index.html
Outdated
<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 comment
The 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 comment
The 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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Also consider name
a required attribute for the input, after form is submitted values from inputs that don't have names are omitted from the payload, structure of the payload is such that the input's name forms a property with corresponding value from the input on the submit payload
You may see this result in network tab after submitting your form, input's that didn't have names are not submitted
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.
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
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 comment
The reason will be displayed to describe this comment to others. Learn more.
Just add to your .form__field
css class value display: block
it should work. Then you can remove the div
elements.
src/index.html
Outdated
|
||
<select id="brandPicker" name="cars" | ||
required multiple> | ||
<option value="bmw">BMW</option> |
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.
These options shouln't have empty lines between them as they are repetitions of the same tag
src/index.html
Outdated
<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 comment
The 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
</div> | ||
|
||
<div> | ||
How do you rate our work? |
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.
This should be a label for the below input
src/index.html
Outdated
|
||
<option value="lada">Lada</option> | ||
|
||
<option value=" " disabled> </option> |
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.
There is no need for this empty option, remove it
</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 comment
The 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 comment
The reason will be displayed to describe this comment to others. Learn more.
Also see that I have wrapped you Do you love cats?
text in a span
,div
element is a container to group up your elements for the purpose their styling/positioning, text alone is not an element and should be nested inside a tag (label wrapping a text and input is one of the exceptions from that rule)
src/index.html
Outdated
disabled> | ||
</option> | ||
|
||
<option value="yes" |
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.
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
Hello Radoslaw, I don't know what You mean about unnecessary divs, I have problem with that, because if I leave only labels everything is inline... You mean I should change something in CSS? I did the rest of the comments. |
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.
Some small improvements need to be fixed and we can move forward 👍🏽
src/index.html
Outdated
Surname: | ||
|
||
<input | ||
type="text" |
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.
Add a 'name' attribute to the input field for 'Surname'. Example: name="surname"
src/index.html
Outdated
How old are You? | ||
|
||
<input | ||
type="number" |
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.
Change the 'name' attribute value to a more descriptive name for the age input field. Example: name="age"
src/index.html
Outdated
Full date of birth: | ||
|
||
<input | ||
type="date" |
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.
Add a 'name' attribute to the input field for 'Full date of birth'. Example: name="birthdate"
src/index.html
Outdated
<label> | ||
Name: | ||
|
||
<input |
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.
Add a 'name' attribute to the input field for 'Name'. Example: name="name"
src/index.html
Outdated
<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 comment
The reason will be displayed to describe this comment to others. Learn more.
Just add to your .form__field
css class value display: block
it should work. Then you can remove the div
elements.
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.
few comment from my side
src/index.html
Outdated
<div> | ||
<label> | ||
I accept the term of the agreement | ||
|
||
<input | ||
type="checkbox" | ||
name="agreement" | ||
required | ||
> | ||
</label> | ||
</div> |
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.
Why you wrapped this label with div element instead of adding form_field class as for other labels? You should try to be consistant with the way you write your code :)
src/index.html
Outdated
> | ||
</label> | ||
|
||
<div> |
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.
Same question here
src/index.html
Outdated
<label class="form__field"> | ||
What are your favorite brand of cars? | ||
|
||
<select id="brandPicker" name="cars" |
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.
You should fix formatting here as Radek mentioned
<select id="brandPicker" name="cars" | |
<select | |
id="brandPicker" | |
name="cars" | |
required | |
multiple | |
> |
src/index.html
Outdated
</fieldset> | ||
|
||
<button type="submit">Submit</button> | ||
|
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.
Remove empty line, it is not needed between parent and child elements
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.
One last mistake left, after it's corrected we'r good :D
</label> | ||
|
||
<div> | ||
<span>Would you recommend us?</span> |
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.
Change this to label for the select and get rid of the div
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 job :)