HTML and CSS Reference
In-Depth Information
If you stick to just letters and numbers (but no leading digits) and rep-
resent spaces with the underscore ( _ ) character, you'll have fewer prob-
lems. For example, cost_in_dollars and overhead_percentage are good
choices for element names; $cost and overhead % might cause problems.
In addition, notice that the name you give to a form control is directly
associated with the data that the user inputs to that control and that
gets passed to the forms-processing server. It is not the same as nor
does it share the same namespace with the name attribute for a hyper-
link fragment or a frame document.
9.5.1. Text Fields in Forms
The HTML and XHTML standards let you include four types of text-entry
controls in your forms: a conventional text-entry field, a masked field
for secure data entry, a field that names a file to be transmitted as part
of your form data, and a special multiline text-entry <textarea> tag. The
first three types are <input> -based controls; the fourth is a separate tag
that we describe later in this chapter, in section 9.7. Conventional text fields
The most common form input control is the text-entry field for user-
names, addresses, and other unique data. A text-entry field appears in
the browser window as an empty box on one line and accepts a single
line of user input. Eventually, that line of text becomes the value of the
control when the user submits the form to the server. To create a text-
entry field inside a form in your document you set the type of the <in-
put> form element to text . Include a name attribute as well; it's required.
What constitutes a line of text differs among the various browsers. For-
tunately, HTML and XHTML give us a way, with the size and maxlength
attributes, to dictate the width (in the number of characters) of the text-
input display box, and how many total characters to accept from the
user, respectively. The value for either attribute is an integer equal to
the maximum number of characters you'll allow the user to see and type
Search WWH ::

Custom Search