HTML and CSS Reference
In-Depth Information
The read-only control is not distinguished in any way from a normal form control.
However, when visitors attempt to enter new information (or, in the case of buttons or
check boxes, select them), they'll find that they cannot change the value. Figure 11.19
shows both a disabled control and a read-only control. You'll generally find disabled to
be more useful because it's less confusing to your users.
FIGURE 11.19
Disabled controls
are dimmed. Read-
only controls
appear normally—
they just can't be
Form Security
It's important to remember that regardless of what you do with your form controls,
what gets sent back to the server when the form is submitted is really up to your
user. There's nothing to stop her from copying the source to your form, creating a
similar page on her own, and submitting that to your server. If the form uses the get
method, the user can just edit the URL when the form has been submitted.
The point here is that there is no form security. In Lesson 15, “Using JavaScript in
Your Pages,” you'll learn how to validate your forms with JavaScript. Even in that
case, you can't guarantee that users will supply the input that you intend. What this
means is that you must always validate the data entered by your users on the
server before you use it.
Applying Cascading Style Sheet
Properties to Form Elements
In this lesson, I've already showed you some approaches you can take to managing the
layout of your forms with CSS. Now I explain how to alter the appearance of form input
fields themselves using style properties. As you can see from the screenshots so far, reg-
ular form controls might not blend in too well with your pages. The default look and feel
of form controls can be altered in just about any way using CSS. For example, in many
browsers, by default, text input fields use Courier as their font, have white backgrounds,
Search WWH ::

Custom Search