`
`tiers HT
`d.XHTML 1.0 including
`
`resentatiop and layout
`
`tructor,
`
`ep
`
`- -a ijd .attAl
`
`FALL LINE EX2007
`
`
`
`HTML:
`The Complete Reference
`Third Edition
`
`Thomas A. Powell
`
`Osborne/McGraw-Hill
`Berkeley New York St. Louis San Francisco
`Auckland Bogota Hamburg London Madrid
`Mexico City Milan Montreal New Delhi Panama City
`Paris Sao Paulo Singapore Sydney
`Tokyo Toronto
`
`n•Nmfpasn-nt
`
`TULSA-ttagablit,Ibi Laurv:Jal:
`
`FALL LINE EX2007
`
`
`
`About the Author...
`Thomas A. Powell has been professionally involved in the
`Internet community for more than 10 years. His career began
`at UCLA's PICnet, followed by several, years at CERFnet, one
`of the first Internet service providers in the country. In 1994,
`he founded the Internet consultancy that eventually became
`PINT, Inc.,(www.pint.com), a well-known Web design and
`development firm headquartered in San Diego, California.
`Beyond his various business interests, Powell is the author
`of numerous books on Web technology, including Web Design:
`The Complete Reference, Web Site Engineering, and HTML
`Programmers Reference. He has also written extensively on the
`subject for Network World, IT World, NetGuide, Internet Week,
`and Interactive Age.
`Mr. Powell teaches Web publishing classes through the
`Information Technologies program at University of California
`San Diego, Extension and also is an instructor the UCSD
`Computer Science and Engineering Department. He holds a
`B.S. front UCLA and an M.S. in computer science from UCSD.
`
`FALL LINE EX2007
`
`
`
`Osborne/McGraw-Hill
`2600 Tenth Street
`Berkeley, California 94710
`U.S.A.
`For information on translations or book distributors outside the U.S.A., or to arrange
`bulk purchase discounts for sales promotions, premiums, or fund-raisers, please
`contact Osborne/McGraw-Hill at the above address.
`HTML: The Complete Reference, Third Edition
`Copyright © 2001 by The McGraw-Hill Companies. All rights reserved. Printed in the
`United States of America. Except as permitted under the Copyright Act of 1976, no part
`of this publication may be reproduced or distributed in any form or by any means, or
`stored in a database or retrieval system, without the prior written permission of the
`publisher, with the exception that the program listings may be entered, stored, and
`executed in a computer system, but they may not be reproduced for publication.
`1234567890 DOC DOC 01987654321
`
`ISBN 0-07-212951-4
`
`Publisher
`Brandon A. Nordin
`Vice President & Associate Publisher
`Scott Rogers
`Acquisitions Editor
`Megg Bonar
`
`Project Editor
`Pamela Woolf
`Acquisitions Coordinator
`Tim Madrid
`
`Copy Editor
`Rachel Lopez
`
`Proofreader
`Sossity Smith
`
`Indexer
`David Heiret
`Computer Designers and Illustrators
`Black Hole Publishing
`
`Series Design
`Peter Hancik
`
`Technical Editor
`Fritz Schneider
`This book was composed with Corel VENTURATm Publisher.
`
`Information has been obtained by Osborne/McGraw-Hill from sources believed to be reliable. However, because of the
`possibility of human or mechanical error by our sources, Osborne/McGraw-Hill, or others, Osborne/McGraw-Hill does not
`guarantee the accuracy, adequacy, or completeness of any information and is not responsible for any errors or omissions or
`the results obtained from use of such information.
`
`FALL LINE EX2007
`
`
`
`C hapter 11: Basic Interactivity and HTML: Forms
`
`11.1.
`
`Note
`
`II <input type="subm& value="Delete Order" name="Delete">
`
`<input type="submit" value="Update Order" name="Update">
`<input type="reset" value="Reset Form" name="ResetButton"›
`When the form is submitted, the value of the button is sent to the form-handling
`program, which will decide what to do with the submitted data based upon its
`contents. This use of a submit button hints at a more generalized form of button, which
`will be discussed in the next section.
`If you have two buttons next to each other; it is useful to separate the two with a
`non-breaking space ( d. Otherwise, the buttons probably will render too closely
`together. Another approach would be to use a small table around the buttons and provide
`some cell padding or a blank cell between the buttons.
`Additional <input> Types
`There are a few forms of the <input> element that have not been discussed. These form.
`elements hint at the potential complexity of using forms. Some of these elements,
`particularly the file selection form element, are not supported in older browserA.
`Hidden Text and Its Uses
`The usefulness of this form control is not always obvious to the new user. By setting
`the type attribute of the <input> element to a value of hidden, it is possible to transmit
`default or previously specified text that is hidden from the user to the handling
`program. If there were many versions of the same form all over a Web site, the hidden
`text could be used to specify where the form came from, as shown here:
`II <input type="hidden" name="SubmittingTormRame" value="Forml"›
`Because this field is not shown on the page, it is difficult but not impossible for the
`user to modify it. Thus, it must have its value attribute set. While this last example
`seems rather contrived, there actually is a very important use for hidden form controls.
`There are some problems with relying on hidden values too much. Consider that
`nefarious users might be able to determine the internal workings of your system or even
`I Note
`falsify requests that include control information in the hidden fields. Not to alarm page
`designers, but do consider that to see hidden form fields all the user has to do is view the
`page source/
`When filling in forms, there often is an issue of remembering information from
`one form to the next. Imagine a form in which the user fills in his or her personal
`information on one page and the ordering information on the next page. How will the
`
`FALL LINE EX2007
`
`
`
`428 HTML: The Complete Reference
`
`two pages be related to each other? This presents the state-loss problem. The protocols
`of the Web, primarily HTTP, do not support a "memory." In other words, they don't
`preserve state. One way to get around this is to use hidden text. Imagine that, in the
`last example, the personal information is passed to the next page by dynamically
`embedding it in the ordering page as hidden text. Then state has been preserved—or
`has it? When users are finished ordering, they submit the whole form at once as a
`complete transaction. This idea of using hidden text to get around the state-loss
`problem is illustrated in Figure 11-4.
`There are other approaches to saving state, including extended path information
`and cookies.
`
`ti
`
`New form
`page comes
`back with
`hidden data
`
`Order Foiiit
`16G 1
`Part#
`ho
`I
`
`Qty.
`
`Hidden
`
`Name:
`
`f Toe
`
`I
`
`ID#
`
`1 765 1
`
`Step 2
`
`• .
`• .
`Figure 114. Ulsing:bidderpforro fields to presove state
`
`FALL LINE EX2007
`
`