Exam 6: Enhancing and Validating Forms

arrow
  • Select Tags
search iconSearch Question
flashcardsStudy Flashcards
  • Select Tags

Instead of document.getElementsByTagName("form")[0] , you could use the code

Free
(Multiple Choice)
4.7/5
(36)
Correct Answer:
Verified

A

Describe two advantages of referencing form objects using methods such as getElementById()rather than the forms array.

Free
(Essay)
4.8/5
(32)
Correct Answer:
Verified

Any two of the following:
One advantage of referencing form objects using methods such as getElementById(   rather than the forms array is that you don't need to switch between using one syntax for  referencing form objects and another syntax for non- form objects.
In addition, using  Document object methods makes your code more flexible when you need the same code to  be able to refer to both form and non- form elements.
Finally, use of the name attribute is not  allowed in the strict DTD for XHTML, so if you're writing JavaScript to work with XHTML  documents, you cannot use the forms array or other browser arrays.

In what situations can you get more accurate information on a form byusing form fields other than text boxes? Name two types of fields you might use instead. 

Free
(Essay)
4.7/5
(35)
Correct Answer:
Verified

Sometimes the information requested for a field is restricted  to a small, discrete list-the names of a few credit cards, for instance . Asking users to type this information opens your form to the possibility  that they'll misspell a word, use an abbreviation that your back-end system doesn't recognize,  or simply enter data that's not within the acceptable parameters . Instead, you can use other types of form fields  to present users with acceptable choices, and limit their options to those choices.
Any two of the following:
option buttons
selection lists
check boxes
sliders
data lists

Match each statement below with correct item:
Determines whether a value is not a number
validity object
Enables customization of validation feedback in modern browsers
bubble
Indicates that a form element must have a value
friction
Correct Answer:
Verified
Premises:
Responses:
Determines whether a value is not a number
validity object
Enables customization of validation feedback in modern browsers
bubble
Indicates that a form element must have a value
friction
Checking that information provided by users conforms to rules
constraint validation API
If all its properties are false , then its value is true
isNaN()function
Stops a form from being submitted when the submit event is triggered
validation
Persistence required for a user to accomplish a goal
required
Displays a validation error in a modern browser
assistive functions
Reduce the likelihood of user errors when completing a form
preventDefault()
Provides guidance about what data should be entered in a text box
placeholder
(Matching)
4.8/5
(41)

By default, browsers create an collection of form objects that you can reference using array notation.

(True/False)
4.8/5
(38)

For all custom validation, it can be helpful to use the __________  structure for handling errors.

(Short Answer)
4.9/5
(38)

How can you add options to a selection list with JavaScript?

(Essay)
4.8/5
(29)

To check a group of fields and trigger an error message if any of them is empty, you use a(n)____ statement.

(Multiple Choice)
4.8/5
(35)

To display no default value on a selection list, you set its ____ property to -1.

(Multiple Choice)
4.9/5
(41)

The ____ event fires when a form is submitted.

(Multiple Choice)
4.9/5
(36)

In modern browsers, which attribute of an input element prevents the form from being submitted if the field is left blank?

(Multiple Choice)
4.9/5
(32)

You can use HTML to set the default value of a selection list so no option is selected.

(True/False)
4.8/5
(34)

Enhancements to HTML and to modern browsers have allowed browsers themselves to  perform many validation tasks without any extra JavaScript. This type of validation  is known as __________ validation.

(Short Answer)
4.9/5
(31)

When a control's value is found to be invalid during constraint validation, the ____ event is triggered.

(Multiple Choice)
4.8/5
(39)

Modern browsers can perform many validation tasks themselves without any extra JavaScript.

(True/False)
4.9/5
(27)

Which form element is useful for limiting user options to a set of choices?

(Multiple Choice)
4.7/5
(41)

Assistive functions perform a type of validation.

(True/False)
4.7/5
(37)

Validation errors found by modern browsers are reported in ____.

(Multiple Choice)
4.9/5
(30)

Which attribute enhances usability in modern browsers?

(Multiple Choice)
4.9/5
(36)

You create an empty document fragment using the ____ method.

(Multiple Choice)
4.8/5
(34)
Showing 1 - 20 of 41
close modal

Filters

  • Essay(0)
  • Multiple Choice(0)
  • Short Answer(0)
  • True False(0)
  • Matching(0)