ptg16476052
332 LESSON 12: Designing Forms
Output ▼
The best thing about using these new HTML5 input controls is that you don’t need any
fallback options to use them. You don’t need JavaScript to set up special controls—
although you can if you want to—because if the browser doesn’t support the input type
you’re using it will display a text field. Because a text field is what you would have had
to use to collect that form data anyway, you lose nothing. You should still validate the
data that comes through your forms, even if the browser does support the input type. And
that fixes bad data problems.
Creating Password Controls
The password and text field types are identical in every way except that the data entered
in a password field is masked so that someone looking over the shoulder of the person
entering information can’t see the value that was typed into the field.
FIGURE 12.10
Color and search
input types.
You don’t have to limit your use of the password control to just
passwords. You can use it for any sensitive material that you feel
needs to be hidden when the user enters it into the form. But
remember that because the text cannot be seen, it can be very
easy to enter it incorrectly. And this makes password fields dif-
ficult to use.
TIP