Forms & Tables | Working with forms Flashcards

1
Q

What is the purpose of the form element in HTML?

A

To gather user information, such as names and email addresses.

The form element is essential for collecting user input in web applications.

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

What does the action attribute in a form specify?

A

Where the form data will be sent upon submission.

The action attribute defines the URL endpoint for form submission.

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

What is an input element in HTML?

A

An element used to collect specific information from users, like names and email addresses.

Input elements are void elements and do not have closing tags.

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

What does the type attribute of an input element define?

A

The data type expected from the user.

For example, ‘text’ expects plaintext input.

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

How do you create an implicit association between a label and an input field?

A

By nesting an input inside a label element.

This method allows the label to be linked to the input without additional attributes.

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

What is the purpose of the for attribute in a label element?

A

To explicitly associate the label with a specific input element.

The values for the for attribute and the input’s id must match.

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

What type of input does the input element with type ‘email’ provide?

A

Basic validation for correctly formatted email addresses.

This helps ensure users enter valid email formats.

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

What is the purpose of the placeholder attribute in an input element?

A

To show additional hints about the expected input format and type.

Placeholder text guides users on how to fill out the input field.

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

Fill in the blank: The term ‘implicit’ refers to something that is _______.

A

understood or inferred without needing to be explicitly stated.

This concept is important in understanding how labels and inputs relate in HTML.

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

True or False: The input element can have multiple closing tags.

A

False.

Input elements are void elements and do not have closing tags.

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

What is the purpose of the button element?

A

To perform a particular action when it is activated.

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

What is an example of a button element text?

A

Start Game

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

What are some actions that a button element can perform?

A
  • Submitting a form
  • Showing a modal
  • Toggling a side menu
How well did you know this?
1
Not at all
2
3
4
5
Perfectly
14
Q

What attribute controls the behavior of a button when activated?

A

type attribute

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

What is the default behavior of a button element when activated?

A

It will not do anything.

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

What type attribute value makes a button interactive, such as showing an alert?

A

button type

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

What is the type attribute value used for submitting a form?

A

submit

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

What happens when a user clicks a submit button in a form?

A

Their data will be sent to the server and processed.

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

What is the type attribute value that clears all input data in a form?

A

reset

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

Why are reset buttons usually not recommended?

A

They could lead to users accidentally resetting their data.

21
Q

What is an alternative way to create buttons in HTML?

A

Using the input element.

22
Q

What type attribute value can an input element have?

A
  • submit
  • reset
  • button
23
Q

What is the main difference between input elements and button elements?

A

Input elements are void elements and cannot have child nodes.

24
Q

What does the value attribute in an input element represent?

A

The button text.

25
What flexibility does the button element offer compared to the input element?
You can nest text, images, and icons inside it.
26
What is client-side form validation in HTML forms?
It ensures that users fill out necessary information in the correct format before submission.
27
What does the term 'client-side' refer to?
Everything that happens on the user's computer or device.
28
What does the term 'server-side' refer to?
Everything that happens on the server, including processing data and handling requests.
29
Why is server-side validation necessary?
It adds security as malicious users can bypass client-side checks.
30
What is an example of built-in form validation in HTML?
Using the required attribute in inputs.
31
What does the required attribute do in an HTML form input?
Specifies that the user must fill out that portion of the form before submission.
32
What happens if a user submits a form without filling out a required field?
They will be alerted that the field is required and the form will not be submitted.
33
What is a common validation feature of email inputs?
They have basic validation to ensure correctly formatted email addresses.
34
What are minlength and maxlength attributes used for?
To set the minimum and maximum length in characters for an input.
35
Fill in the blank: The _______ attribute specifies that an input field must be filled out.
required
36
True or False: Browsers perform extensive validation on all email addresses.
False
37
What will happen if the input length does not meet minlength or exceeds maxlength?
The browser will show an alert message.
38
What is the consequence of not including additional layers of validation?
The basic validation may not be sufficient for all cases.
39
What are the different form states in HTML?
The different form states are: * Default state * Focused state * Disabled state * Readonly state ## Footnote Each state serves a specific purpose in user interaction.
40
What is the default state of an email address input?
The default state is a blank input ## Footnote This is what the email input looks like when it is first rendered on the page.
41
What indicates that a form control is in the focused state?
A blue highlighted border around the input ## Footnote This occurs when the user clicks on the form control or selects it with the keyboard's tab key.
42
What does the disabled state signify for an input?
The input cannot be focused or activated ## Footnote To disable an input, the disabled boolean attribute is added to the element.
43
How can you disable an email input in HTML?
## Footnote This code snippet demonstrates how to implement the disabled state.
44
What happens when a user tries to click on a disabled input?
The focus will not be enabled ## Footnote Users cannot interact with disabled inputs.
45
What is the readonly state in HTML?
The input is not editable by the user ## Footnote Users can see the value but cannot change it.
46
How is an email input set to readonly in HTML?
## Footnote This code snippet sets the input to readonly with an initial value.
47
What is a key difference between the disabled state and readonly state?
Readonly can be focused while disabled cannot ## Footnote This allows users to select readonly inputs but not interact with disabled ones.
48
Why is understanding different form states important?
They ensure a smooth user experience by providing clear feedback and guidance ## Footnote This helps in handling errors effectively.