How to Write Web Forms By Mimi Opkins.

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

Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
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.
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.
USER INTERACTIONS: FORMS
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.
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.
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.
1 HTML References: A HTML Tutorial: /HTMLPrimer.html
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.
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.
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.
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.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
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.
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.
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 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.
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.
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
Introduction to HTML Forms and Servlets
HTML Forms Pat Morin COMP 2405.
(and available form fields)
FORMS Explained By: Sarbjit Kaur.
ITE 115 Creating Web Page Forms
Web Programming– UFCFB Lecture 10
ARUSHA TECHNICAL COLLEGE WEB DESIGN(html forms)
Designing Forms Lesson 10.
Introducing Forms.
HTML Forms and User Input
HTML: Basic Tags & Form Tags
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.
CNIT 131 HTML5 - Forms.
Web Development & Design Foundations with H T M L 5
Creating Forms on a Web Page
HTML Forms 18-Apr-19.
© Hugh McCabe 2000 Web Authoring Lecture 8
Unit 5 Create Forms.
HTML: Basic Tags & Form Tags
Presentation transcript:

How to Write Web Forms By Mimi Opkins

What We’ll Cover Today HTML Forms Fields Validation Processing

Forms Provides Information to Servers Uses a variety of different input fields to gather data JavaScript can be used to validate input Server program typically returns an HTML page back to the browser

Form Components Form Header Named Input Fields Action Buttons

Form Tag Makes up the Form Header component All form elements are contained within FORM tags <FORM> </FORM>

Form Tag (con’t.) ACTION attributes specifies the URL of the processing script (program) <FORM ACTION=myprog.php>

Form Tag (con’t.) METHOD attribute tells the browser how to send the form data to the server GET POST example: <FORM METHOD=POST ACTION=myprog.php>

Form Fields Example

Form Fields Example

Form Fields Example

Form Fields Example

Named Input Fields Comprise the bulk of a form Appear as standard window controls such as buttons and boxes Can assign each field a unique name that is later used in the script

Types of Input Fields Text Box Password Box Checkbox Radio Button Hidden Field Text Areas (Windows) Images File Menu

Input Tag Handles the majority of named input fields Can place most of the fields you need on your form Different attributes depending on the value of the TYPE attribute <INPUT TYPE=field type>

Text and Password Fields Simple Data Entry Fields Password field appears as **** Requires the NAME attribute <INPUT TYPE=TEXT NAME=“vendor”> <INPUT TYPE=PASSWORD NAME=“secret”>

Text and Password Fields Optional Attributes SIZE how many characters wide the field will be MAXLENGTH maximum number of characters that can be entered in the field VALUE place default text in the field

Checkboxes Used to provide users with several choices <INPUT TYPE=“CHECKBOX” NAME=“cream” VALUE=“CREAM”> <INPUT TYPE=“CHECKBOX” NAME=“sweetner” VALUE=“SUGAR”> CHECKED attribute preselects a checkbox

Radio Buttons Only one option can be selected <INPUT TYPE=“RADIO” NAME=“drink” VALUE=“COFFEE”> <INPUT TYPE=“RADIO” NAME=“drink” VALUE=“TEA”> CHECKED attribute preselects a radio button

Hidden Fields Used to send information to the server about a form Not used for data entry Field contents are not displayed <INPUT TYPE=“HIDDEN” NAME=“secret code” VALUE=“XYZ”>

Textarea Tag Used for multiple-line text entries Use the TEXTAREA tags Text between the TEXTAREA tags shows up on the input window by default

Textarea Optional Attributes COLS specifies number of columns ROWS specifies number of rows WRAP Netscape extension to wrap the text in the window

Menus Used to produce pull-down or scrollable option menus Uses the SELECT and OPTIONS tags <SELECT NAME=“pets”> <OPTION>DOG</OPTION> <OPTION>CAT</OPTION> </SELECT>

Menu Optional Attributes SIZE attribute in SELECT tag specifies how many options to be displayed on the screen (default is 1) MULTIPLE attribute in SELECT tag users can choose multiple options

Menu Optional Attributes (con’t.) SELECTED attribute in OPTION tag preselects an option VALUE attribute in OPTION tag value sent to server instead of the option displayed on the browser screen

Action Buttons SUBMIT users submit the data they entered to the server <INPUT TYPE=“SUBMIT” VALUE=“Submit Data”>

Action Buttons (con’t.) RESET clears out any data entered into the forms and sets all the named input fields back to their default values <INPUT TYPE=“RESET” VALUE=“Clear Data”>

Using Images as Submit Buttons Can create a custom image to be a SUBMIT button Clicking it instructs the browser to submit the form Use the TYPE and SRC attributes <INPUT TYPE=“IMAGE” SRC=myimg.gif>

Form Validation Form Validation can be accomplished with JavaScript on the Client Side Scripts on the Server Side

Form Navigation By default, the natural tabbing order will match the source order in the markup. The tabindex is used to define a sequence that users follow when they use the Tab key to navigate through a page.

Tab Order

Using Tabindex in a Form

What is Tabindex "the position of the current element in the tabbing order for the current document" What this means is that when a customer comes to your page, if they hit tab to navigate through the site, the first link they will be taken to is the link listed as tabindex="1". This is followed by tabindex="2" and tabindex="3"... Then elements that do not have a tabindex set (or don't support the tabindex attribute) come after that, in the order they appear on the page.

What Elements Support Tabindex a <a href="" tabindex="1"></a> area <area href="" tabindex="1" type="rect" coords="" /> button <button tabindex="1" name="" value="" id="" /> input <input tabindex="1" name="" value="" id="" /> object <object tabindex="1" name="" value="" id="" /> select <select tabindex="1" name="" value="" id="" ></select> textarea <textarea tabindex="1" cols="30" rows="4"></textarea>

Using Tabindex – It’s Simple Go to your web page and look at it as if you were a customer. When a customer comes to the page, what is she likely to want to click on first? Or what do you want her to click on first? Make that tabindex="1". Move through the page in that fashion.

Passing Form Data When the SUBMIT button is clicked, the browser Packages the form data into a single string -- encoding Sends the encoded string to the server using either the GET or the POST method

URL Encoding Browser gathers all the data and strings it together using NAME=VALUE pairs Pairs are separated by &

URL Encoding Example If I entered my name into the following form: <FORM ACTION=myprog.php METHOD=“POST”> <INPUT TYPE=“TEXT” NAME=“first”> <INPUT TYPE=“TEXT” NAME=“last”> <INPUT TYPE=“SUBMIT”> </FORM>

URL Encoding Example (con’t.) URL encoded string first=Mimi&last=Opkins POST will sent it via Standard Input GET will append the string to the URL myprog.php?first=Mimi&last=Opkins

More Encoding Blanks are translated to ‘+’ I love HTML becomes I+love+HTML Special characters become a % followed by their hexadecimal equivalent ! Becomes %21 I love HTML! Becomes I+love+HTML%21

HTTP Methods Method used by the form is stored in the REQUEST_METHOD environment variable For GET method, the input is stored in QUERY_STRING For POST method, the input is in STDIN

Form Processing Server Executes PHP Program PHP Program reads in form values Process Program Generates HTML page Returns control to the Web Server Resulting Page is returned to the browser

PHP Behinds the Scenes Unencode the data %xx becomes a special character + becomes a blank comment=I+love+HTML%21 becomes comment=I love HTML!

PHP Behinds the Scenes (con’t.) Divide the data into NAME=VALUE pairs by splitting at each & first=Mimi&last=Opkins becomes first=Mimi last=Opkins Loads data into predefined variables according to their name Handles both scalar and array data