Skip to content
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

add task solution #788

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions readme.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# HTML form
Replace `<your_account>` with your Github username and copy the links to Pull Request description:
- [DEMO LINK](https://<your_account>.github.io/layout_html-form/)
- [TEST REPORT LINK](https://<your_account>.github.io/layout_html-form/report/html_report/)
- [DEMO LINK](https://IvanRovenko.github.io/layout_html-form/)
- [TEST REPORT LINK](https://IvanRovenko.github.io/layout_html-form/report/html_report/)

> Follow [this instructions](https://mate-academy.github.io/layout_task-guideline/#how-to-solve-the-layout-tasks-on-github)
___
Expand Down Expand Up @@ -40,7 +40,7 @@ Create HTML page with form. On form submit send form data to `https://mate-acade
- Age should be at least `1` and at max `100` with a default value of `12`
- The email field should have placeholder value: `[email protected]`.
- Text fields should have `autocomplete="off"`.
- `Submit` button should have a `type="submit"`
- `Submit` button should have a `type="submit"`
- Vertical distance between inputs should be `10px`
- Vertical distance between groups should be `20px`
- Any other styles should be browser default
Expand Down
155 changes: 154 additions & 1 deletion src/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,160 @@
<link rel="stylesheet" href="./style.css">
</head>
<body>
<h1>HTML Form</h1>

<form action="https://mate-academy-form-lesson.herokuapp.com/create-application" method="post">
<fieldset class="form">
<legend>Personal information</legend>

<div class="form-field">
Surname:
<input
type="text"
name="Surname"
autocomplete="off"
>
</div>
Comment on lines +19 to +26

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

  1. use label instead of div
  2. apply code styling recommendations
Suggested change
<div class="form-field">
Surname:
<input
type="text"
name="Surname"
autocomplete="off"
>
</div>
<label class="form-field">
Surname:
<input
type="text"
name="Surname"
autocomplete="off"
>
</label>

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi, i need chenge oll div to label ?


<div class="form-field">
Name:
<input
type="text"
name="Name"
maxlength="25"
autocomplete="off"
>
</div>

<div class="form-field">
How old are You?
<input
type="number"
name="How old are You?"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a more descriptive name for the 'name' attribute. For example, 'age'.

min="1"
max="100"
value="12"
>
</div>

<div class="form-field">
Full date of birth:
<input
type="date"
name="Full date of birth"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a more descriptive name for the 'name' attribute. For example, 'dateOfBirth'.

>
</div>

<div class="form-field">
I accept the term of the agreement
<input
type="checkbox"
name="I accept the term of the agreement"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a more descriptive name for the 'name' attribute. For example, 'termsAgreement'.

>
</div>
</fieldset>

<fieldset class="form">
<legend>Registration</legend>

<div class="form-field">
E-mail:
<input
type="email"
name="E-mail"
placeholder="[email protected]"
>
</div>
<div class="form-field">
Password:
<input
type="password"
name="Password"
minlength="5"
>
</div>
</fieldset>

<fieldset class="form">

<legend>An interesting fact about you!</legend>

<div class="form-field">
Do you love cats?
<label>
<input
type="radio"
name="Yes"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Radio buttons for the same question should have the same 'name' attribute. Change the 'name' attribute to 'loveCats' for both 'Yes' and 'No' options.

>
Yes
</label>

<label>
<input
type="radio"
name="No"
>
No
</label>
</div>

<div class="form-field">
What is your favorite color?
<input
type="color"
name="color"
>
</div>

<div class="form-field">
What time do you go to bed?
<input
type="time"
name="time"
>
</div>

<div class="form-field">
What are your favorite brend of cars?
<label>
<select name="car" multiple>
<option value="BMW">BMW</option>
<option value="Audi">Audi</option>
<option value="Jeep">Lada</option>

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The option text should match the value attribute. Change the option text to 'Lada' instead of 'Jeep'.

</select>
</label>
</div>
<div class="form-field">
How do you rate our work?
<input
type="range"
name="rate worl"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use a more descriptive name for the 'name' attribute. For example, 'workRating'.

>
</div>
</fieldset>

<fieldset class="form">
<legend>Aditional info</legend>

<div class="form-field">
Comments:
<textarea
name="Comments"
></textarea>
</div>

<div class="form-field">
Would you recommend us?
<label>
<select name="recommend" required>
<option value="Yes">Yes</option>
<option value="No">No</option>
</select>
</label>
</div>

</fieldset>
<button type="submit">Submit</button>
</form>
<script type="text/javascript" src="./main.js"></script>
</body>
</html>
18 changes: 17 additions & 1 deletion src/style.css
Original file line number Diff line number Diff line change
@@ -1 +1,17 @@
/* styles go here */
.body {

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use 'body' instead of '.body' to select the body element.

margin: 0;
}

.form {
margin-bottom: 20px;

}

.form-field {

padding-bottom: 10px;
}

.form-field:last-child {
padding-bottom: 0;
}
Comment on lines +5 to +17

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

no needs to add all of these classes.
You may only apply those to your filedset and form field (label or div)
Example:

.form-fieldset:not(:last-child) {
  margin-bottom: 20px
}

.form-field:not(:last-child) {
  margin-bottom: 10px
}