When a form uses the GET method, the browser places its values in the .
7 Forms and User Input Online Quiz Questions
Use this free practice quiz with 20 questions to review 7 Forms and User Input, test your knowledge, and prepare for your next test or exam.
Which HTML attribute identifies a control's value in submitted form data? Enter the attribute name.
A form control has a visible label whose for value matches the control's id. This connection can help people using assistive technology identify and navigate the control.
- A
True
- B
False
A form submits or changes data, and its values should be sent in the request body rather than placed in the URL. Which method best fits?
- A
GET, because it places values in the request body - B
POST, because it sends values in the request body - C
GET, because it sends values only to the server - D
POST, because it places values in the URL
To explicitly connect a label to its control, use matching values on the label and the control.
An application listens for a form's submit event instead of only listening for a submit-button click. This allows it to handle submission initiated by keyboard as well.
- A
True
- B
False
A form uses browser constraints to improve usability. Which additional step is necessary to protect the application when data is submitted?
- A
Rely on browser constraints because users cannot change them
- B
Validate only when a field uses the
emailinput type - C
Validate submitted data on the server as well as using client-side checks for usability
- D
Skip validation for requests sent without the page
A message field must contain at least 10 characters. Which implementation both applies a native HTML constraint and clearly informs users of the requirement?
- A
Set
minlengthwithout explaining the requirement to users - B
Set
minlengthand explain the minimum in visible text - C
Put the minimum only in a JavaScript comment
- D
Rely on an error color to communicate the minimum
Select all statements that accurately describe form control names and browser assistance for data entry.
- A
A control's
nameidentifies its value in submitted form data - B
A control without a
nameis always included in submitted form data - C
Choosing an appropriate input
typeand usefulautocompletevalues can help browsers and users enter data - D
The
autocompleteattribute determines where the form sends its data
In a JavaScript submit event handler, which method should you call to stop the browser's default navigation when your code will handle the form data? Enter the method name, including parentheses.
A form's values are being sent to /contact, but the submission is not processed. Which statement best describes the role of the form's destination setting and the server?
- A
The
methodspecifies the endpoint, so configuring the server is unnecessary - B
The
actionspecifies the destination, and the server must be configured to receive and process the submission - C
The
namespecifies the destination, and the browser processes the submission - D
The
autocompletespecifies the destination, and the browser stores the submission
After JavaScript handles a form submission, which approach provides clear feedback that is also associated with assistive technology?
- A
Change the submit button color without adding text
- B
Write the result only to the browser console
- C
Update a status element configured with
role="status"andaria-live="polite" - D
Show feedback in an unrelated part of the page without identifying it
Select all statements that accurately describe browser validation and JavaScript-triggered form submission.
- A
requestSubmit()follows normal validation and submit-event behavior - B
form.submit()bypasses both normal validation and submit-event behavior - C
The browser normally performs constraint validation before firing the
submitevent - D
form.submit()always fires thesubmitevent after checking constraints
Describe how a server-backed form should handle submitted data and communicate the outcome to users.
In an HTML form, how do you explicitly associate a visible label with its input control?
- A
Give the label and control the same name attribute.
- B
Set the label’s for value to the control’s id.
- C
Place the label after the control and omit its for attribute.
- D
Set the label’s id to the control’s name.
You are building a set of related radio buttons. Which HTML structure provides a semantic group and a descriptive title for that group?
- A
Use a paragraph to group controls and a placeholder as its heading.
- B
Use a label around all the controls and give it a name attribute.
- C
Use a fieldset to group the controls and a legend to describe the group.
- D
Use a form element for each control and an option element as the group title.
A form submits a search query, and the application is designed for the submitted values to appear in the URL. Which method best fits this use?
- A
GET
- B
POST
- C
FormData
- D
requestSubmit()
In an HTML form, which attribute specifies where the browser sends the submitted data? Enter the attribute name.
Which form event should JavaScript listen for so that keyboard-based submission is handled as well as button-initiated submission? Enter the event name.
In JavaScript, calling requestSubmit() follows normal constraint validation and submit-event behavior, while calling form.submit() bypasses both.
- A
True
- B
False