Creating Forms in HTML Flashcards

1
Q

What are the three basic elements of a form?

A

The form itself, the inputs and the submit button.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
2
Q

Which vscode extension allow automatic refresh of the website changes? Is there an alternative?

A

Live server… then click “go live” in the status bar. Yes… browser-sync for npm.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
3
Q

What is the type of the input that triggers an action in the server? What is the default method of the form?

A

type=”submit”. The default method is GET.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
4
Q

Which is the most common encoding used in forms?

A

url-encoded

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
5
Q

What is the basic utility of a form?

A

Allows the user to interact with the website.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
6
Q

What are the basinc input categories?

A

text, multi line text (text area) and selection.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
7
Q

When should we use the input type hidden? Can we place passwords there?

A

So the specified/fixed value is sent over the get/post request. Do not use to send passwords and other secrets since it is still show up in the network view.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
8
Q

How to create a textarea input that has a initial size?

A

Via cols and rows properties.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
9
Q

Can the forms be rendered in a different way in different browsers? Cite an example.

A

Yes. Date picker button inside the input on webkit and not visible in firefox.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
10
Q

What happens if a check box with the same name but different values are checked? Is it supported by the backend frameworks?

A

The post method will have the name duplicated, the value will be different. Yes.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
11
Q

How to group form inputs? How to add a text to that group? Where this text element needs to be set?

A

Via fieldset html element. Via legent html element. Inside the fieldset

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
12
Q

What is the use of the label html element?

A

To associate text/icons with a specific input.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
13
Q

How to explicit and implicit connect a label to an input?

A

via property for=”id of input” and by enclosing the input with the label element.

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What does the tabindex property do with the html elements?

A

Defines the tab order;

How well did you know this?
1
Not at all
2
3
4
5
Perfectly
15
Q

Tabindex starts with the number…? And 0 means? Negative means?

A
  1. 0 means the last element. negative means will never be accessible via tabs.
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
16
Q

Should I define tabindex in all focusable elements in the form? What if I do?

A

No. If you do, all elements needs tab indexes.

17
Q

How to apply a css style to an email input?

A

input[type=”email”]{
background-color: purple;
}

18
Q

What does the label {display: block;} does? why?

A

Makes the input after the label go down. Because lables are by default inline elements.

19
Q

How to round the corners of the inputs?

A

border-radius: 7px

20
Q

What are simple and common client validation attributes? Cite 2 for minimum validation and how to require a field.

A

min, minLength and required.

21
Q

Which one is a complex but more complete client validation?

A

pattern (regex)

22
Q

How to apply styles based on validity (pseudo-class)?

A

input: valid {border-color: green}
input: invalid

23
Q

How to use pseudo-class to make an invalid field black-bordered when selected?

A

input:focus:invalid {border-color: black;}

24
Q

Does validation in the client replaces the server ones and vice versa?

A

No. Server side validation is even more important the client side ones.