HTML and CSS Reference
In-Depth Information
Correct answer: C
4.
Incorrect: You can do this with a custom event, but that's more work than
necessary.
A.
Incorrect: The goal is to validate the data before submitting the form.
B.
Correct: The required attribute ensures that a field contains a value before being
submitted.
C.
Incorrect: A label would be informative but doesn't guarantee that all the required
fields are populated before submitting.
D.
Objective 3.2: Thought experiment
The safest approach to restricting input data is to restrict the characters that a user can enter
into a specific field. If a field is designed to accept only numeric data, ensure that the valida-
tion on that input control will allow only numeric data. The same is true for dates, text, and
any other input that a user can freely type into. Regular expressions simplify this type of
validation by verifying that only the expected characters are entered. If a text box is expect-
ing a person's name, don't allow HTML characters such as the < or > symbols to be input into
the field. Also, restrict the field length so that it matches the type of the data expected. A field
expecting the age of a person doesn't need to be 500 characters; you can probably get away
with allowing only 3 characters.
Objective 3.2: Review
Correct answer: A
1.
Correct: The $ sign denotes the end of the string.
A.
Incorrect: The % sign doesn't denote the end of the string.
B.
Incorrect: The ^ character denotes the start of the string.
C.
Incorrect: The & character doesn't denote the end of the string.
D.
Correct answer: D
2.
Incorrect: Allows scripts to run
A.
Incorrect: Only allows content from the same origin
B.
Incorrect: Allows forms
C.
Correct: Allows content from the containing HTML document
D.
Incorrect: Not a valid option
E.
Search WWH ::




Custom Search