Forms Flashcards

1
Q

“<form></form>” How would you describe what it does.

A

the form element is a container for a set of controls [usually “<input></input>” elements], that sends data to an address with the action=”” attribute.

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

How does a form element know where to submit the data?

A

The element knows to submit to the location specified in the action attribute.

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

What can you do with the method=”” attribute on a form?

A

method=”get” … [default] the form data is appended to the URL with a ? separator, use this if the form has no side effects.

method=”post” … the form data is sent as the request body.

method=”dialog” … when the form is within a “<dialog>" element, closes the dialog and throws a submit event on submission without submitting the data or clearing the form.</dialog>

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

What can the target=”” attribute do on a form?

A

The target attribute indicates where to display a response.

_self [default] loads reply into the same browsing context as the current one.

_blank loads into a new unnamed browsing context

_parent loads into the parent browsing context of the current, if there is no parent this will function the same as _self.

_top loads into the top level browsing content, [Oldest ancestor without a parent] if there is none, will behave as _self.

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

What element is used to specify what controls are associated with?

A

The “<label></label>” element, specified with the for=”” attribute.

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

How does the name=”” attribute impact forms?

A

The name attribute will create a key=value pair to submit into the form, each pair will be appended by a & separator.

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

Do “<button></button>” elements behave differently in a form?

A

Yes, their default behavior in a form will be to submit, need type=”button” to go back to original behavior.

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

input type=”button”

A

An input element that will display as a clickable button.

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

input type=”checkbox”

A

Creates a checkbox to select/deselect.

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

input type=”color”

A

Creates a color picker.

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

input type=”email”

A

Creates a text field for general validation parameters around email addresses.

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

input type=”file”

A

Creates a file selector input for the document.

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

input type=”hidden”

A

A control that is not displayed, but still has its value submitted to the server[form action address].

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

input type=”number”

A

A control that displays a spinner and lets the user input numbers, with numeric validation.

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

input type=”password”

A

Creates a text field that will have it’s value obscured. Will alert user if site is not secure.

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

input type=”radio”

A

Creates a single value to be selected from a group that share the same name=”” value.

17
Q

input type=”range”

A

Creates a slider range, defaults to the middle value and can have a set min and max.

18
Q

input type=”tel”

A

Creates a text field for entering telephone numbers.

19
Q

input pattern=””

A

The pattern attribute sets a regex to match the value to.

20
Q

input type=”text”

A

A standard text field with no validations.

21
Q

input type=”url”

A

Creates a text field that has general validation parameters for URLs.

22
Q

input type=”text” required

A

The required attribute makes the text field have to be completed before form submission.