Home > Articles > Graphics & Web Design > Dreamweaver & Flash

This chapter is from the book

Forms: A Brief Introduction

An HTML component that you haven't seen yet is the form. Forms are used to create the interactive elements of Web sites. As such, it isn't something you'll really get a chance to use until you've reached the dynamic portions of Dreamweaver MX. If you need to create forms that connect to existing dynamic applications, you'll have to learn the tools, so let's do that now.

There really isn't a good way to demonstrate the use of form elements until they come into play later in the text, so this will just serve as a reference until later.

Here is a summary of Insert panel form objects, and what they're used for:

Form—The <form> tag set contains the other elements in the form and determines how they will be transmitted to an application for processing. Just as a <table> object holds rows and cells, the <form> holds input fields, buttons, and so on.
Text Field—Text fields are used to collect information from the users. Although text fields are single-line elements, Dreamweaver MX abstracts the text field to a point where it can instantly be converted to and from a multiline field (actually a <textarea>).
Hidden Field—Hidden fields are used to carry data along with the form that you might not really want the user to see. Check out Day 6, "Introduction to Dynamic Web Applications and Database Design," for more information on variable passing. Hidden fields should never be used to pass sensitive information. Users can always create a local copy of a form with hidden fields and manually edit the fields to contain whatever data they want. A bank, for example, wouldn't want to pass a user's current balance around through a hidden field. The users could potentially edit the value and drastically increase their net worth.
Text Area—Text areas, like text fields, are used to collect information from the users. Text areas, however are multiline text fields and can collect several lines of information. Dreamweaver MX can convert text areas to text fields and vice versa.
Check Box—The check box is used to create a group of items that can be turned off or on. This is usually used on a form to select multiple attributes that apply to something (implying an AND state). The most common misuse of the check box is applying it to OR states, such as "Click yes OR no."
Radio Button—Similar to the check box, the radio button also enables users to choose among several attributes on a form. Unlike the check box, however, the radio should be used when an OR state is implied. If two radio buttons share the same name, they are mutually exclusive of one another. (Both cannot be selected at the same time.) Radio buttons are sometimes used in the place of check boxes. If each radio button is named differently, this almost works. When a radio button is set, it cannot be unselected unless a Reset button is supplied for the form.
Radio Group—Because radio buttons are usually added in groups, the Radio Group tool automates the process. This is used to create a collect of like-named radio buttons and their labels.
List/Menu—The list/menu is a rather bizarre construct because it behaves very differently between its two forms. In one configuration, it is simply a pop-up menu that can be used to choose one option among several choices (for example, choose your state from the list). In its other incarnation, it displays as a rectangular scrolling list in which multiple items can be highlighted. In my opinion, although they take more room, check boxes are better suited to providing the "pick all that apply" functionality than lists are.
Jump Menu—The jump menu is not a form element, but is a JavaScript construct that you can use on any page, regardless of whether it is part of a server-processed form. Creating a jump menu in your document creates a simple pop-up menu that visitors can use to quickly jump to different parts of your Web site.
Image Field—Image fields are typically used as graphical form submit buttons, yet they also transmit back information to the server in the form of the X and Y coordinates where the click took place—just like an image map.
File Field—The file field is finally starting to be useful now that all modern browsers support it. If you've seen one of the "Upload your files to 20MB of free remote storage" Web sites, you've probably seen the file field in use. The file field enables a Web page to submit an entire file to a server for processing. Some of the more interesting uses of this feature have been on Web pages that allow retailers to customize their merchandise by uploading a logo that is then mapped to their product catalog.
Button—Button elements are most frequently used to submit the contents of a form, or reset them to their default values.
Label/Fieldset—The final two buttons in the form category of the Insert panel—label and fieldset—simply insert the <label> and <fieldset> tags into the document. They do not add anything to the design window.

As you work with form elements, you'll start to understand the common elements between them. Most form elements, for example, submit information, have a default value, and a name.

Text Fields

For example, let's take a look at the most common element you'll see—text fields. Add in a text field by clicking the Text Field icon in the Tool panel or by choosing Text Field from the Form Object submenu under Insert. A single field should be inserted into the document. Select the field in the design view and open the Properties panel, shown in Figure 3.22.

Figure 3.22 Form objects have properties, just like everything else.

Here you can change the attributes of the text field that is being used in the document. The three variations of fields available from the one Text Field tool are as follows:

Single line—Inputs a single line of text at a time. Although you can use this to input long sentences and even paragraphs, it's mostly useful for gathering one or two words from the users. This is the default text field type.
Multi line—Lets the users type multiple lines of data in a more free-form style. This field type does not allow styles as in a traditional word processor, but does give the same cursor control that users are accustomed to. Although accessed using the same Text Field tool, this form element is actually quite different from the other two options.
Password—The password field is just what it sounds like, a field for entering passwords. This field type is identical to the single line field, but it replaces the user input with symbols so that it can't be read. In all honesty, there is very little protection offered by using this field on a page. It does not secure a site and only offers a very basic visual form of protection.

Besides setting a field type, you also need to set a name for each field. This name will be used by the Dreamweaver server behaviors to receive and process incoming data.

A few other fields can be set in order to restrict the user's input or change the way the field is displayed onscreen. They are as follows:

Char Width—The character width attribute determines the number of characters that can be entered into the field and displayed onscreen at a time. This does not affect the number of characters that the field can hold; only the number that can be seen.
Max Chars (Single line and Password only)—The maximum number of characters a field can hold. Use this value to set an upper limit on the typing that a user can perform. This is useful for keeping data within the defined size limits of the fields.
Num Lines (Multi line option only)—For multi-line displays, this attribute replaces the Max Chars option. The Num Lines determines the number of rows of text that will be visible to the users when they enter information. There is no way to set the maximum number of characters in a multi-line field, other than checking its size with JavaScript.
Init Val—The initial value that the field will contain. This value will show up in the form when it is first displayed. This value can be edited by the person viewing the form.

CAUTION

Be careful when using initial values. Users have a tendency to skip over already filled-in fields. You might end up with bad data unless you force them to choose a value.

Wrap (Multi line option only)—The Wrap attribute controls how text is wrapped when the end of the line is reached in a multi-line form element. The Off setting will scroll the text area horizontally when the user reaches the edge of the text area. Pressing Return is the only way to start a new line. Virtual will automatically place the cursor on the next line when it reaches the edge of the text area but doesn't add an EOL (End of Line) character to the text. Physical behaves the same way as a Virtual wrap, but it does insert an EOL at the end of each line.

Submit Buttons

Another common form element is the button. Buttons are usually used to trigger the processing of form information. Clicking the button object in the Insert panel will add a basic Submit button to the form at your present cursor position.

The properties of a simple Submit button are shown in Figure 3.23.

Figure 3.23 You can name your button from the Properties panel.

If you're just using the button to submit a form, most likely all you need to set is the label. The button label is the text that is actually drawn inside the button graphic on the page. Don't confuse this with the button name, which provides a form field name for the button object.

TIP

What good is a field name for a button? Actually, buttons are just as valid an input device as any other field on a form. For example, assume that you have a form collecting data on your inventory of video tapes. Rather than having a radio button or text field that needs to be set each time for the rating (G, PG, PG-13, R, or NC-17), you could set the value as part of the submit process. You would just create five submit buttons sharing the common name "rating." Each would submit a different value for the movie's rating when it is clicked. Don't discount the usefulness of the button as an input device.

There are two other actions that a button can take on. The action you've probably seen before on other pages is the reset action. A button defined as a reset button and added to a form will automatically change all field values to their defaults when it is clicked. This provides a convenient way for a user to start over without having to manually clear out data from the fields in the form.

CAUTION

Be careful when labeling and placing your Submit and Reset buttons on the page. If a user spends 15 minutes filling out a form on a page, only to click the Reset button because it is featured more prominently than the Submit button, he or she is likely to give up.

NOTE

The reset action resets the form to its initial empty state. If you used initial values for your fields, however, those values are restored as well.

The other type of button action, None, is no action at all. This is generally used in conjunction with JavaScript to provide client-side behaviors.

Image Buttons

If you want to be fancy with your presentation, there is another type of button you can use to submit data: an image button. This button is a bit strange in that it doesn't submit data to the server in exactly the same format as the standard HTML Submit button. To add an image button to your document, click the Image Field item in the Forms panel. As with any image, you'll be prompted for the location of the image file. This is a pure HTML construct and doesn't use any JavaScript, so it is just an image—there is no down or rollover state for it.

The behavior of the Image Field starts out the same as a standard Submit button—it submits the contents of the current form to the server for processing. However, it also sends additional data about where the user clicked on the image button in order to cause the submit to take place. This additional information is encoded into two additional variables named with the original image field name, but with a X and a Y on the end, and it contains the X and Y coordinates of the user's click in the image.

This information can be used for processing real-time image maps of images that are generated on-the-fly, or for guessing games in which the user must click somewhere on an image in order to win a prize.

The drawback to using image fields as buttons is that they don't offer the same level of feedback as traditional buttons, and they are difficult to maintain. Every time you want to change a button on your page, you have to edit the graphic of the button—not just edit its label. On a positive note, I find that graphical buttons are "prettier" and offer a friendlier browsing experience. They can be laid out on the screen precisely as you want them, rather than you relying on the browser to render a button with the same dimensions you happened to have in mind.

Although this is but a short introduction to forms, you shouldn't worry about not getting to use them later. We'll use make of the form objects once we reach the dynamic portions of this book.

InformIT Promotional Mailings & Special Offers

I would like to receive exclusive offers and hear about products from InformIT and its family of brands. I can unsubscribe at any time.

Overview


Pearson Education, Inc., 221 River Street, Hoboken, New Jersey 07030, (Pearson) presents this site to provide information about products and services that can be purchased through this site.

This privacy notice provides an overview of our commitment to privacy and describes how we collect, protect, use and share personal information collected through this site. Please note that other Pearson websites and online products and services have their own separate privacy policies.

Collection and Use of Information


To conduct business and deliver products and services, Pearson collects and uses personal information in several ways in connection with this site, including:

Questions and Inquiries

For inquiries and questions, we collect the inquiry or question, together with name, contact details (email address, phone number and mailing address) and any other additional information voluntarily submitted to us through a Contact Us form or an email. We use this information to address the inquiry and respond to the question.

Online Store

For orders and purchases placed through our online store on this site, we collect order details, name, institution name and address (if applicable), email address, phone number, shipping and billing addresses, credit/debit card information, shipping options and any instructions. We use this information to complete transactions, fulfill orders, communicate with individuals placing orders or visiting the online store, and for related purposes.

Surveys

Pearson may offer opportunities to provide feedback or participate in surveys, including surveys evaluating Pearson products, services or sites. Participation is voluntary. Pearson collects information requested in the survey questions and uses the information to evaluate, support, maintain and improve products, services or sites, develop new products and services, conduct educational research and for other purposes specified in the survey.

Contests and Drawings

Occasionally, we may sponsor a contest or drawing. Participation is optional. Pearson collects name, contact information and other information specified on the entry form for the contest or drawing to conduct the contest or drawing. Pearson may collect additional personal information from the winners of a contest or drawing in order to award the prize and for tax reporting purposes, as required by law.

Newsletters

If you have elected to receive email newsletters or promotional mailings and special offers but want to unsubscribe, simply email information@informit.com.

Service Announcements

On rare occasions it is necessary to send out a strictly service related announcement. For instance, if our service is temporarily suspended for maintenance we might send users an email. Generally, users may not opt-out of these communications, though they can deactivate their account information. However, these communications are not promotional in nature.

Customer Service

We communicate with users on a regular basis to provide requested services and in regard to issues relating to their account we reply via email or phone in accordance with the users' wishes when a user submits their information through our Contact Us form.

Other Collection and Use of Information


Application and System Logs

Pearson automatically collects log data to help ensure the delivery, availability and security of this site. Log data may include technical information about how a user or visitor connected to this site, such as browser type, type of computer/device, operating system, internet service provider and IP address. We use this information for support purposes and to monitor the health of the site, identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents and appropriately scale computing resources.

Web Analytics

Pearson may use third party web trend analytical services, including Google Analytics, to collect visitor information, such as IP addresses, browser types, referring pages, pages visited and time spent on a particular site. While these analytical services collect and report information on an anonymous basis, they may use cookies to gather web trend information. The information gathered may enable Pearson (but not the third party web trend services) to link information with application and system log data. Pearson uses this information for system administration and to identify problems, improve service, detect unauthorized access and fraudulent activity, prevent and respond to security incidents, appropriately scale computing resources and otherwise support and deliver this site and its services.

Cookies and Related Technologies

This site uses cookies and similar technologies to personalize content, measure traffic patterns, control security, track use and access of information on this site, and provide interest-based messages and advertising. Users can manage and block the use of cookies through their browser. Disabling or blocking certain cookies may limit the functionality of this site.

Do Not Track

This site currently does not respond to Do Not Track signals.

Security


Pearson uses appropriate physical, administrative and technical security measures to protect personal information from unauthorized access, use and disclosure.

Children


This site is not directed to children under the age of 13.

Marketing


Pearson may send or direct marketing communications to users, provided that

  • Pearson will not use personal information collected or processed as a K-12 school service provider for the purpose of directed or targeted advertising.
  • Such marketing is consistent with applicable law and Pearson's legal obligations.
  • Pearson will not knowingly direct or send marketing communications to an individual who has expressed a preference not to receive marketing.
  • Where required by applicable law, express or implied consent to marketing exists and has not been withdrawn.

Pearson may provide personal information to a third party service provider on a restricted basis to provide marketing solely on behalf of Pearson or an affiliate or customer for whom Pearson is a service provider. Marketing preferences may be changed at any time.

Correcting/Updating Personal Information


If a user's personally identifiable information changes (such as your postal address or email address), we provide a way to correct or update that user's personal data provided to us. This can be done on the Account page. If a user no longer desires our service and desires to delete his or her account, please contact us at customer-service@informit.com and we will process the deletion of a user's account.

Choice/Opt-out


Users can always make an informed choice as to whether they should proceed with certain services offered by InformIT. If you choose to remove yourself from our mailing list(s) simply visit the following page and uncheck any communication you no longer want to receive: www.informit.com/u.aspx.

Sale of Personal Information


Pearson does not rent or sell personal information in exchange for any payment of money.

While Pearson does not sell personal information, as defined in Nevada law, Nevada residents may email a request for no sale of their personal information to NevadaDesignatedRequest@pearson.com.

Supplemental Privacy Statement for California Residents


California residents should read our Supplemental privacy statement for California residents in conjunction with this Privacy Notice. The Supplemental privacy statement for California residents explains Pearson's commitment to comply with California law and applies to personal information of California residents collected in connection with this site and the Services.

Sharing and Disclosure


Pearson may disclose personal information, as follows:

  • As required by law.
  • With the consent of the individual (or their parent, if the individual is a minor)
  • In response to a subpoena, court order or legal process, to the extent permitted or required by law
  • To protect the security and safety of individuals, data, assets and systems, consistent with applicable law
  • In connection the sale, joint venture or other transfer of some or all of its company or assets, subject to the provisions of this Privacy Notice
  • To investigate or address actual or suspected fraud or other illegal activities
  • To exercise its legal rights, including enforcement of the Terms of Use for this site or another contract
  • To affiliated Pearson companies and other companies and organizations who perform work for Pearson and are obligated to protect the privacy of personal information consistent with this Privacy Notice
  • To a school, organization, company or government agency, where Pearson collects or processes the personal information in a school setting or on behalf of such organization, company or government agency.

Links


This web site contains links to other sites. Please be aware that we are not responsible for the privacy practices of such other sites. We encourage our users to be aware when they leave our site and to read the privacy statements of each and every web site that collects Personal Information. This privacy statement applies solely to information collected by this web site.

Requests and Contact


Please contact us about this Privacy Notice or if you have any requests or questions relating to the privacy of your personal information.

Changes to this Privacy Notice


We may revise this Privacy Notice through an updated posting. We will identify the effective date of the revision in the posting. Often, updates are made to provide greater clarity or to comply with changes in regulatory requirements. If the updates involve material changes to the collection, protection, use or disclosure of Personal Information, Pearson will provide notice of the change through a conspicuous notice on this site or other appropriate way. Continued use of the site after the effective date of a posted revision evidences acceptance. Please contact us if you have questions or concerns about the Privacy Notice or any objection to any revisions.

Last Update: November 17, 2020