110 likes | 137 Views
Explore the basic structure of HTML forms, learn about different form fields, labels, and processing scripts. Understand the types of input methods and how to format the user interface effectively.
E N D
HTML Form Teppo Räisänen LIIKE/OAMK 2011
Basic Structure of a HTML Form • The element defining a form is ’form’ • Form’s most important attributes are • The processing script (action) • Way of transmitting the information (method) • The available transmitting methods are ’get’ ja ’post’
Basic Structure of a HTML Form • A form is one of the block elements, so it can include other block and inline elements • Tables • Paragraphs… • The most primitive form would include a single form field and instructions of use for the field
Types of Form Fields • For input • input • textarea • select • The type attribute is used for more accurate specification • The browsers will generate the forms UI using the information about input types
Types of Form Fields • Submit • Reset • Hidden • Text • Password • Textarea • File
Types of Form Fields • Select • Radio • Checkbox
Labels for Form fields • Information of how to use form fields must be provided for the user • For the information one can use a label element or just simply text inside form • For formatting the final UI a table layout or div elements can be used
Web Forms • HTML forms look lot like printed out forms • The processing of a HTML form is completed by a computer • Form element is used as an interface between the processing side and the user
Web Forms • There are form fields included inside the form for different pieces and types of information • An address of the processing script is written as a part of form element’s declaration • Scripts are small scaled computer programs
Web Forms <form method=”post” action=” http://www.myserver.com/cgi-bin/formprocessing.cgi”><input name=“id" size=“20” /><input type="submit" value=“Send” /></form>
Web Forms • The script for processing can reside in any available server • After submitting the form, the information inside the form is sent for processing • The form data is often ’raw data’ not meant to be analyzed by human resources