CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

23-Aug-14 HTML/XHTML Forms. 2 What are forms? is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually.
24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Video, audio, embed, iframe, HTML Form
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
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.
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.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
HTML F ORMS. F ORMS HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, checkboxes, radio-buttons,
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
XP Tutorial 6New Perspectives on Creating Web Pages with HTML, XHTML, and XML 1 Creating Web Page Forms Designing a Product Registration Form Tutorial.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
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.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
HTML Forms.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
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.
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.
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.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
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,
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
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.
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.
©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.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
HTML Forms.
Week 10: HTML Forms HNDIT11062 – Web Development.
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.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
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.
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.
Client-Side Internet and Web Programming
How to Write Web Forms By Mimi Opkins.
CS3220 Web and Internet Programming HTML Tables and Forms
HTML Forms Pat Morin COMP 2405.
FORMS Explained By: Sarbjit Kaur.
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Validation and Building Small Apps
Introducing Forms.
Creating Form Elements
Creating Form Elements
Web Development & Design Foundations with H T M L 5
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.
Forms, cont’d.
CS3220 Web and Internet Programming HTML Tables and Forms
Creating Forms on a Web Page
HTML Forms 18-Apr-19.
© Hugh McCabe 2000 Web Authoring Lecture 8
Lesson 6: Web Forms.
Presentation transcript:

CSC 2720 Building Web Applications HTML Forms

Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a server side program to process  The collected input can also be processed using JavaScript on the client machine

HTML Forms ( form )  The tag is used to create an HTML form for user input.  A form can contain input elements (also known as controls) like text fields, checkboxes, radio-buttons, submit buttons, select menus, text area, field set, etc.  Forms are used to pass data to a server.  Ref:

A Sample Form Using GET <form action=" method="GET"> First name: Last name: Example: A form with three controls: two text fields and one submit button

Attribute action of element form  Every form element has a required attribute action, which specifies the URL of the program to be used to process the form data.  For example, specifies that the form data are to be submitted to a server- side program named SomeProgram. The request is to be sent to a web server running on the local machine.  Note:  localhost (or IP ) is a qualified name referring to the local machine.  8088 is the port number in which the web server in this example is listening to. The server admin can change this number. If not set, port 80 is assumed.

Form Submission Methods  Two methods to send form data  GET  Data are encoded directly in the URL  e.g.:  The default method  POST  Data are encoded in the body of the HTTP request  e.g.:

Form Submission Using GET Method

Submission Result Using GET Method

Form Submission Using POST Method

Submission Result Using POST Method

GET vs. POST  GET  Data are encoded directly in the URL  The default method  Can only contain limited amount of data (browser dependent)  Can be bookmarked (persistent)  POST  Data are encoded in the body of a HTTP request  More secure and unlimited data size  Cannot be easily seen or modified through the web client  Can be encrypted if secure HTTP is used  Cannot be bookmarked

Form Data  Data collected in a form are sent to the server program as name=value pairs.  name is the name assigned to a control and value is the data value collected by the control.  The name=value pairs are separated by ‘ & ’ from each other.  With the GET method, the encoded data are appended to the URL of the server side program (separated by a ‘ ? ’)  e.g.: Query string

URL Encoding  Some characters have to be specially encoded in the URL. e.g.:  '/' as %2F, '&' as %26, '?' as %3F, ' ' as '+' or %20, '+' as %2B, …  Full list:  e.g.: The value Tom & Jerry may appear in the URL as Tom+%26+Jerry  Useful if you want to  Understand or modify the data encoded in the URL directly  Form data is automatically encoded before they are sent to the server.

Controls

 Each control should have the required attribute " name " in its tag. e.g.:  The value of each control is a character string. (Some controls can have multiple values)

Text Box or Text Field <input type="text" name="LoginName" value="Initial Value" />  Element: input  Attributes  type: must be "text"  name: name of this form element  value: (Optional) Initial value place in the text box  Other optional attributes: readonly, maxlength, disabled  Purpose  For collecting input in the form of a single line text

Password Field <input type="password" name="Pass" />  Element: input  Attributes  type: must be "password"  name: name of this form element  Other optional attributes: value, disabled  Purpose  For collecting sensitive data such as password which you don't want to reveal on the user's web client  The collected value is sent as plain text!  POST method should be used if a form contains password field. Note: The box is initially empty. The value is entered through keyboard.

Text Area <textarea name="name" cols="25" rows="5"> Initial text to appear in the text area.  Element: textarea  Attributes  name: name of this form element  cols, rows: number of columns and rows measured in characters  Other optional attributes: disabled, readonly  Purpose  For collecting text input that spans multiple lines  For displaying multiple lines of texts such as user agreement  Everything, including HTML tags, space, and newline characters that appear in … are preserved.

Check Box <input type="checkbox" name="coke" checked /> Coke <input type="checkbox" name="fries" /> Fries  Element: input  Attributes  type: must be "checkbox"  name: name of this form element  Other optional attributes: disabled, checked, value  Purpose  To allow users to select or unselect an item

Radio Button <input type="radio" name="lang" value="Java" checked /> Java <input type="radio" name="lang" value="C++" /> C++ <input type="radio" name="lang" value="JavaScript" /> JavaScript  Element: input  Attributes  type: must be "radio"  name: name of this form element  Radio buttons belonging to the same group have the same name  value: value of each element  Other optional attributes: disabled, checked  Purpose  To allow users to select one of several items

Combo Box C C++ Java Smalltalk Pascal  Element: select  Attributes  name: name of this form element  Other optional attributes: disabled, multiple, size  Purpose  To allow users to select one of many items  Element: option  Attributes  value: value corresponding to the list item  selected: Set initial selected item  Purpose  To specify a list item

Selectable List C C++ Java Smalltalk Pascal  Element: select  Attributes  name: name of this form element  multiple: When appear in tag, allows multiple selection  size: Number of visible list items in the list  Other optional attributes: disabled  Purpose  To allow users to select zero or more items from a list

Regular, Reset, and Submit Buttons  Element: input  Attributes  type: must be one of "button", "submit", and "reset"  value: Text to appear on the buttons  If omitted for submit buttons, the default value of "Submit" is used  If omitted for reset buttons, the default value of "Reset" is used  Other optional attributes: name, disabled  Purpose  type="button": To initiate an action such as executing a Javascript code  type="submit": To send the form data  type="reset": to clear the form data and set them to their initial state

Another Kind of Buttons Hello! Accept Reset  Element: button  Attributes  type: "button", "submit", or "reset" (default is "button")  Other optional attributes: name, value, disabled  Can be used to create fancier looking buttons.  Between the …, one can place image, text that spans multiple lines, or both.

Other Controls and Options  File upload controls  Lets user select a file and send it to the server  Server-side image maps  User clicks on an image and form gets submitted  Form data are sent as name.x=x-pos&name.y=y-pos  Hidden fields  Represent name and value pair in a form  For keeping some "variables" in the form  Grouping Controls  fieldset lets you visually group form elements.

HTML Forms - Summary  General process  Form uses action to specify base URL  Form elements each have a name  User supplies values  When form is submitted, form data are sent to the server side program as "name" and "value" pairs using either GET or POST method  Add a submit button to allow the users to initiate form submission  Note: A HTML document may contains more than one form.  You can find more form examples at w3schools.w3schools