JavaScript Form Validation Flashcards

(30 cards)

1
Q

HTML form is used to collect user input. True or false?

A

True.

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

What elements do you put inside the form element?

A

The Input element and Label element are the most common ones.

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

What is the label element for?

A

defines a label for several form elements.

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

Name all 9 types of the input element.

A

Text, password, submit, reset, button, checkbox, number, radio, range.

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

What is the default input type?

A

Text.

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

Text is a single-line text input field. True or false?

A

True.

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

What does the password input type do?

A

It makes the user’s input in the form of circles or asterisks.

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

Is the submit input type a text-field?

A

No. It is a button.

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

What does the submit input type do?

A

It submits user’s input to form handler.

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

What does the reset input type do?

A

It resets the user’s input to default value.

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

With the radio input type, you can only click one option. T or F?

A

T.

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

The radio input type will only work if all the names are the same but the ids are different. T or F?

A

T.

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

Can the checkbox input type serve as a to do list?

A

Yes. It is possible.

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

The button input type is a button that can be used for any use. T or F?

A

T

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

What does the number input type do?

A

It lets the user to input a number.

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

You can set restrictions on what numbers are accepted. T or F?

A

T. Use the min attribute and the max attribute.

17
Q

What element do you use to define a dropdown?

A

use the select element.

18
Q

What element do you need for the select element?

A

The option element.

19
Q

What does the option element define?

A

It defines the option in a select element which defines a dropdown.

20
Q

What element do you use to define a multi-line input field?

A

textarea element.

21
Q

What attribute do you put inside the input element to specify an initial value for an input field?

A

The value attribute.

22
Q

What does the readonly attribute do?

A

It cannot be modified. But it can be copy-pasted.

23
Q

What does the disabled attribute do?

A

It disables an input element. It is unusable and un-clickable. The value of a disabled input element will not be sent when submitting the form.

24
Q

What does the size attribute do?

A

specifies the visible width, in characters, of an input field.

25
What is the default size value?
20.
26
The maxlength attribute specifies the maximum number of characters allowed in an input field. T or F?
T.
27
What does the required attribute do?
With the required attribute, you cannot submit the form if it is not filled out.
28
What does the JavaScript form validation do?
It validates if the user input is valid or if it meets the requirements.
29
What does this "==" comparison operator do?
Equal to. It submits true if the operands are equal.
30
What does this "!=" comparison operator do?
Submits true of the operands are not equal.