HTML and CSS Reference
In-Depth Information
FIGURE 3-19 The required field validation invoked
The capabilities of the input controls can provide quite a robust validation framework.
However, more needs to be done to ensure that the website is safe and secure.
Thought experiment
Creating dynamic forms
In this thought experiment, apply what you've learned about this objective. You can
find answers to these questions in the “Answers” section at the end of this chapter.
Building on the thought experiment from Objective 1.3, consider what you need to
do to add custom validation to a control based on what a user has entered in the
previous field. Having a dynamically created form where you can change the valida-
tion rules as a user progresses through the form can be quite powerful. Consider
different cultural variations to rules on phone numbers, postal codes, and email ad-
dress suffixes. Describe how you would implement the validation so that you could
provide context rich validation for the user.
Objective summary
Input controls such as text and textarea allow users to type information into a
Some input controls provide built-in validation, such as for URLs and email addresses.
Radio buttons and check boxes provide controls for users to select items in a list.
Reset and submit buttons control behavior of the HTML form.
Users can't modify the content of a control that has the readonly attribute assigned.
You can add a spelling checker to a text box to help users avoid spelling errors.
The pattern attribute helps define a regular expression for custom validation of
formatted data.
The required attribute ensures that a field is populated before users can submit the
Search WWH ::

Custom Search