HTML Forms http://jjcweb.jjay.cuny.edu/ssengupta/.

Slides:



Advertisements
Similar presentations
Tutorial 6 Creating a Web Form
Advertisements

XP 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
Creating Web Page Forms. Objectives Describe how Web forms can interact with a server-based program Insert a form into a Web page Create and format a.
Tutorial 6 Working with Web Forms
XP Tutorial 6: Creating Web Page Forms. XP An Example of a Form.
XP 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web Page Forms.
XP Creating Web Pages with HTML, 3e Prepared by: C. Hueckstaedt, Tutorial 6 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Creating Web Page Forms
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
4-Sep-15 HTML Forms Mrs. Goins Web Design Class. Parts of a Web Form A Form is an area that can contain Form Control/Elements. Each piece of information.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
XP Tutorial 6New Perspectives on HTML and XHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Forms and Form Controls Chapter What is a Form?
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
XP 1 New Perspectives on Creating Web Pages with HTML Tutorial 6: Creating Web Page Forms.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 HTML Forms
Week 9 - Form Basics Key Concepts 1. 1.Describe common uses of forms on web pages 2.Create forms on web pages using the form, input, textarea, and select.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
1 HTML Forms
1 HTML Forms
XP 1 Tutorial 6 Creating Web Page Forms. XP 2 Tutorial Objectives  Describe how Web forms can interact with a server-based program  Review the various.
Form Components and Elements
1 HTML Forms
+ FORMS HTML forms are used to pass data to a server. begins and ends a form Forms are made up of input elements Every input element has a name and value.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Creating Web Page Forms COE 201- Computer Proficiency.
HTML Creating Forms on a Web Page. 2 Objectives  Discuss the process of creating a form  Distinguish between data input controls and text input controls.
Week 10: HTML Forms HNDIT11062 – Web Development.
HTML Forms. A form is simply an area that can contain form fields. Form fields are objects that allow the visitor to enter information - for example text.
1 HTML Forms
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
1 HTML forms (cont.)
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
Tutorial 6 Creating a Web Form
Lesson 5 Introduction to HTML Forms. Lesson 5 Forms A form is an area that can contain form elements. Form elements are elements that allow the user to.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Tutorial 6 Working with Web Forms
Client-Side Internet and Web Programming
Tutorial 6 - Creating Web Page Forms
Objectives Design a form Create a form Create text fields
ITE 115 Creating Web Page Forms
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Today - Forms! WD Students produce a basic HTML/XHTML document using forms. Find the group that best matches the part of the project you are going.
New Perspectives on Creating Web Pages with HTML
Designing Forms Lesson 10.
Introducing Forms.
Objectives Explore web forms Work with form servers
FORM OBJECT When creating an interactive web site for the Internet it is necessary to capture user input and process this input. Based on the result of.
CNIT 131 HTML5 - Forms.
Creating Forms on a Web Page
Chapter 6: Creating Web Page Forms. An Example of a Form.
Unit 5 Create Forms.
Presentation transcript:

HTML Forms http://jjcweb.jjay.cuny.edu/ssengupta/

An example of an HTML form

Form components and elements text box This figure shows a form that contains various control elements commonly used in Web page forms. First Name Last Name Address #1 Address #2 City State Zip Country Item Purchased Purchase Date drop-down list box Serial Number Used For (check one) Network Operating System (check all that apply) Netware Home Business Banyan Vines Religious or Charitable Institution Windows radio buttons Government IBM Lan Server check boxes Educational Institution PC/NFS text area Comments?: Send Registration Cancel form button

Form control elements Control elements that are commonly used: text boxes for text and numerical entries selection lists for long lists of options, usually appearing in a drop-down list box radio buttons, also called option buttons, to select a single option from a predefined list check boxes to specify an item as either present or absent, can have multiple choices text areas for extended entries that can include several lines of text buttons that can be clicked to start processing the form

Form control elements (cont.) Each control element in which the user can enter information is called a field Information entered into a field is called the field value, or simply the value In some fields, users are free to enter anything they choose Other fields, such as selection lists, limit the user to a predefined list of options

Forms and Server-Based Programs While HTML supports the creation of forms, it does not include tools to process the information. The information can be processed through a program running on a Web server.

Forms and Server-Based Programs Server-based programs are written in many languages The earliest and most commonly used are Common Gateway Interface (CGI) scripts that are written in Perl. Other popular languages include: ASP ColdFusion C/C++ PHP VBScript

Let’s start with creating some HTML Forms…

Create a simple form structure… The <form> tag identifies the beginning and end of a form A single page can include several different forms, but you cannot nest one form inside another The general syntax of the <form> tag is: <form attributes> form elements and layout tags </form> Between the <form> and </form> tags, place the various tags for each of the fields in the form

The <form> tag (cont.) A single Web page can contain multiple forms, the <form> tag includes the name or id attribute. name/id attribute identifies each form on the page. name/id attribute is also needed for programs that retrieve values from the form.

Creating a field set A fieldset groups similar fields together When rendered by browser, a field set appears as a box surrounding the fields Example <fieldset id=“contact”> <legend align=“value”>contact information</legend> </fieldset> the <legend> tag is used to display a legend for a field set legend text specifies the text for that legend

Now the actual form control elements…

The <input> tag <input> tag specifies particular input types for a form syntax <input type=“type”>

Working with text box The general syntax is: <input type=“type” name=“name” id=“id”> type specifies the type of input field name and id attributes identifies the input field for the CGI script To create a text box, you would enter the tag: <input type=“text”> If the type attribute is not included, the Web browser assumes, by default, that you want to create a text box.

Controlling the size of a text box By default, all text boxes are 20 characters wide. The syntax for changing the size of a text box is: <input size=“value”> value is the size of the text box in characters Exmaple <input type=“text” name=“fname” id=“fname” size=“30”>

Setting the maximum length for text input Setting the width of a text box does not limit the number of characters the box can hold. if a user enters text longer than the box’s width, the text scrolls to the left the user cannot see the entire text, but all of it is sent to the CGI script for processing The syntax for setting the maximum length for field input is: <input maxlength=“value”> value is the maximum number of characters that can be stored in the field

Setting a default value for a field When the same value is entered into a field, it may make sense to define a default value for a field. Default values can save time and increase accuracy for users of a Web site. To define a default value, use the following syntax: <input value=“value”> value is the default text or number that is displayed in the field

Creating a text box (all together) To create a text box, use the following HTML code: <input type=“text” name=“name” id=“id” value=“value” size=“value” maxlength=“value”> name and id attributes identify the field value attribute assigns a default value to the text box size attribute defines the width of the text box in number of characters maxlength attribute defines the maximum number of characters allowed in the field

Working with form labels HTML allows a label to be linked with an associated text element – using for attribute The syntax for creating a form label is: <label for=“id”>label text</label> id is the value of the id attribute for a field on the form label text is the text of the label A form label has to be bound with the id attribute, NOT the name attribute of a field

Example <label for=“fname”> First Name </label> <input type=“text” name=“fname” id=“fname”> <label for=“lname”> Last Name <input type=“text” name=“lname” id=“lname”> </label>

Input types This figure shows other supported HTML input types.

Working with radio buttons Radio buttons display a list of choices from which a user makes a selection. Only one radio button can be selected at a time. The syntax to create a radio button is: <input type=“radio” name=“name” id=“id” value=“value”> name identifies the field containing the radio button id attribute identifies the specific option. Only required if you intend to use a field label with the radio button value attribute indicates the value sent to the CGI script, if that radio button is selected by the user

Working with radio buttons (cont.) The name attribute must be included, because it groups distinct radio buttons together. selecting one radio button in the group automatically deselects all of the other radio buttons in that group Insert descriptive text next to the button. Enclose text within a label tag to allow the user to select the radio button or label.

Creating a password field A password field is a text box in which the characters typed by the user are displayed as bullets or asterisks i.e. ****. The syntax for creating a Password field is: <input type=“password”> Using a password field is NOT equivalent to having a secure connection. The password itself is NOT encrypted. The password field only acts as a mask for a field entry as it is entered.