Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.

Slides:



Advertisements
Similar presentations
LIS651 lecture 0 forms Thomas Krichel
Advertisements

HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Video, audio, embed, iframe, HTML Form
Technologies for web publishing Ing. Václav Freylich Lecture 4.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Forms Review. 2 Using Forms tag  Contains the form elements on a web page  Container tag tag  Configures a variety of form elements including text.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
USER INTERACTIONS: FORMS
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
ECA 228 Internet/Intranet Design I Forms. ECA 228 Internet/Intranet Design I Forms forms are a way for a user to communicate with you – text fields –
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 07: Forms - Spring 2011.
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?
1 Forms A form is the usual way that information is gotten from a browser to a server –HTML has tags to create a collection of objects that implement this.
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 - Forms By Joaquin Vila, Ph.D.. Form Tag The FORM tag specifies a fill-out form within an HTML document. More than one fill-out form can be in a.
Forms Sangeetha Parthasarathy 02/05/2001. Introduction to Forms A form makes it possible to transform your web pages from text to graphics to interactive.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
HTML - Forms By Joaquin Vila, Ph.D.. Form Tag The FORM tag specifies a fill-out form within an HTML document. More than one fill-out form can be in a.
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.
76 © 1998, 1999, 2000 David T. Gray, Howard Duncan, Jane Kernan Frames When displaying information in a browser, it is sometimes useful to divide the display.
ITCS373: Internet Technology Lecture 5: More HTML.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
HTML Forms A Preliminary Step into Dynamic Web Fred Durao
TJ 3043 – Web Application Development HTML Form. 2.0 Forms A form is the usual way to communicate information from a Web browser to a server HTML has.
1 Form Elements  Form elements have properties: Text boxes, Password boxes, Checkboxes, Option(Radio) buttons, Submit, Reset, File, Hidden and Image.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
1 Review of Form Elements. 2 The tag Used in between tags.  Form elements(text control, buttons, etc.. ) goes here. OR  Form elements(text control,
HTML Forms a form is a container for input elements on a web page input elements contain data that is sent to the web server for processing.
TJ 3043 – Web Application Development HTML Form. 2.0 Forms - A form is the usual way information is gotten from a browser to a server - HTML has tags.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
+ 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.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
Starting BBEdit or Notepad and Opening the HTML File Start BBEdit or Notepad Select Open from the File Menu Open survey1.htm from the Public Folder.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Project 6 Creating Forms on a Web Page. Objectives Define terms related to forms Describe the different form controls and their uses Use the tag Create.
HTML Form Inputs. Creating a basic form …content goes here…
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
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.
HTML Forms.
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.
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
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.
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.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Informatics Computer School CS114 Web Publishing HTML Lesson 4.
How to Write Web Forms By Mimi Opkins.
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Introducing Forms.
Creating Form Elements
Creating Form Elements
Web Development & Design Foundations with H T M L 5
Forms, cont’d.
Creating Forms on a Web Page
Lesson 6: Web Forms.
Presentation transcript:

Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger

HTML Forms  CGI programs often deal with user input.  The only way to get user input from a browser is to use a form.  ISINDEX tag also allows user input but is limited to a single item.  FORM tag allows greater content CGI and Forms 2

FORM Method  Each HTML form contains the following:  METHOD specifies the HTTP method used to send the request to the server when the user submits the form  ACTION specifies the URL the request is sent to.  We have seen the two common methods used:  GET : any user input is submitted as part of the URI following a “?”. GET foo?name=joe&cookie=oreo HTTP/1.0  POST : any user input is submitted as the content of the request (after the HTTP headers). CGI and Forms 3

Sample POST Request POST /dir/foo HTTP/1.1 User-Agent: Netscape Content-Length: 20 Cookie: favorite=chocolatechip ECACChamps: RPI name=joe&cookie=oreo POST /dir/foo HTTP/1.1 User-Agent: Netscape Content-Length: 20 Cookie: favorite=chocolatechip ECACChamps: RPI name=joe&cookie=oreo CGI and Forms 4

Form ACTION attribute  The ACTION attribute specifies the URL to which the request is sent.  Some examples: ACTION=“ ACTION=“myprog” CGI and Forms 5

Tag Examples <FORM METHOD=“POST” ACTION=“ bin/myprog”> <FORM METHOD=“POST” <FORM METHOD=“POST” ACTION=“ bin/myprog”> <FORM METHOD=“POST” CGI and Forms 6

Inside a form  Between the and tags you define the text and fields that make up the form.  You can use normal HTML tags to format the text however you want.  The fields are defined using tags as well. CGI and Forms 7

Form Fields  There are a variety of types of form fields:  text fields: text, password, textarea  radio buttons  checkboxs  buttons: user defined, submit, reset (clear)  hidden fields CGI and Forms 8

Input Fields  There are a number of field types that allow the user to type in a string value as input.  Each field is created using an tag with the attribute TYPE.  The TYPE attribute is used to specify what kind of input is allowed: TEXT, PASSWORD, FILE,...  Every INPUT tag must have a NAME attribute. CGI and Forms 9

TEXT Fields  TEXT is the most common type of input:  user can enter a single line of text.  Additional attributes can specify: the maximum string length - MAXLENGTH the size of the input box drawn by the browser - SIZE a default value - VALUE CGI and Forms 10

TEXT INPUT Examples <INPUT TYPE=“TEXT” NAME=“PIZZA” SIZE=10 MAXLENGTH=20 VALUE=“Pepperoni”> <INPUT TYPE=“TEXT” NAME=“PIZZA” SIZE=10 MAXLENGTH=20 VALUE=“Pepperoni”> CGI and Forms 11

An example form Your Name: Your Age: Your Name: Your Age: CGI and Forms 12

Submission Buttons  Another type of INPUT field is the submission button.  When a user clicks on a submit button  the browser submits the contents of all other fields to a web server  using the METHOD and ACTION attributes. CGI and Forms 13

Reset Buttons  An INPUT of type RESET tells the browser to display a button that will clear all the fields in the form. <INPUT TYPE=RESET VALUE="press me to clear form"> CGI and Forms 14

A Complete Form Example Your Name: Your Age: Your Name: Your Age: CGI and Forms 15

Other Inputs  Checkboxes  present user with items that can be selected or deselected.  Each checkbox has a name and a value and can be initially selected/deselected  Example checkbox definitions: CGI and Forms 16

Checkbox example Select all the cookies you want to order: Oreo Oatmeal Chocolate Chip Select all the cookies you want to order: Oreo Oatmeal Chocolate Chip CGI and Forms 17

Radio Buttons  Radio Buttons are like checkbox except that the user can select only one item at a time.  All radio buttons in a group have the same NAME. CGI and Forms 18

Radio Button Example Select all the cookies you want to order: Oreo Oatmeal ChocolateChip Select all the cookies you want to order: Oreo Oatmeal ChocolateChip CGI and Forms 19

Multiline Text  The TEXTAREA tag creates an area where the user can submit multiple lines of text.  This is not another type of tag! CGI and Forms 20

TEXTAREA Attributes  Each TEXTAREA tag has attributes NAME, COLS and ROWS. default text goes here (or can be empty) CGI and Forms 21

TEXTAREA example Please enter your address in the space provided: Please enter your address in the space provided: CGI and Forms 22 textarea1.html

Form Submission  When the user presses on a SUBMIT button the following happens:  browser uses the FORM method and action attributes to construct a request.  A query string is built using the (name,value) pairs from each form element.  Query string is URL-encoded. CGI and Forms 23

Input Submissions  For each checkbox selected the name,value pair is sent.  For all checkboxes that are not selected - nothing is sent.  A single name,value pair is sent for each group of radio buttons. CGI and Forms 24

Other Form Field Types  There are other form field types:  SELECT - pulldown menu or scrolled list of choices.  Image Buttons  Push Buttons (choice of submit buttons) CGI and Forms 25

Hidden Fields  Nothing is displayed by the browser.  The name,value are sent along with the submission request. <INPUT TYPE=HIDDEN NAME=SECRET VALUE=AGENT> CGI and Forms 26

Hidden does not mean secure!  Anyone can look at the source of an HTML document.  hidden fields are part of the document!  If a form uses GET, all the name/value pairs are sent as part of the URI  URI shows up in the browser as the location of the current page CGI and Forms 27

Typical FORM CGI setup  User fills out a form and presses submit.  CGI program gets a set of name,value pairs  one for each form field.  CGI decides what to do based on the name,value pairs  sometimes creates a new form based on the submission. CGI and Forms 28