HTML and CSS Reference
In-Depth Information
Objective 3.1: Validate user input by using HTML5
This objective examines the user interface elements made available by HTML5 that allow
users to provide input. The ability to capture information from users is a great feature. How-
ever, you must ensure that user privacy and safety are protected as best as possible. You also
must ensure that the website doesn't open any holes that an attacker can exploit to disrupt
the site's services. Part of protecting the site is choosing the correct user input controls for
the job and setting the appropriate attributes on those controls to ensure that the data is
validated. For the exam, you need to know these input controls and the attributes they use
for this purpose.
This objective covers how to:
Choose input controls and HTML 5 input types
Implement content attributes
Choosing input controls
HTML5 provides a wide assortment of controls to make capturing user input simple and
secure. In this section, you explore the user input controls in greater detail and see examples
of their usage. A simulation of a survey form will be created to demonstrate when each type
of control should be used. Listing 3-1 shows the entire markup for the survey.
LISTING 3-1 HTML5 markup for a customer survey,
<h1>Customer Satisfaction is #1</h1>
<h2>Please take the time to fill out the following survey</h2>
<td>Your Secret Code:
<input type="text" readonly="readonly" value="00XY998BB"/>
<input type="password"/>
Search WWH ::

Custom Search