WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Forms in JavaScript (NON-audio version) © Dr. David C. Gibbs 2003-04.

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

WEB DESIGN TABLES, PAGE LAYOUT AND FORMS. Page Layout Page Layout is an important part of web design Why do you think your page layout is important?
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Forms in JavaScript (there is an audio component to this eLesson) © Dr.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Using Data Types (No Audio Component) © Dr. David C. Gibbs
JavaScript Forms Form Validation Cookies CGI Programs.
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
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.
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.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
1 More JavaScript, HTML Forms, CGI Scripts Tom Horton Alfred C. Weaver CS453 Electronic Commerce.
CST JavaScript Validating Form Data with JavaScript.
Chapter 9 Working with Forms. Principles of Web Design 2nd Ed. Chapter 9 2 Principles of Web Design Chapter 9 Objectives Understand how forms work Understand.
Chapter 9 Collecting Data with Forms. A form on a web page consists of form objects such as text boxes or radio buttons into which users type information.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
INTRODUCTION TO WEB DEVELOPMENT AND HTML Lecture 07: Forms - Spring 2011.
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.
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.
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
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 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.
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.
Working with Forms. How Forms Work Forms let you build interactive Web pages that collect information from a user and process it on the Web server The.
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
Website Development with PHP and MySQL Saving Data.
 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 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
HTML, Third Edition--Illustrated Introductory 1 HTML, Third Edition Illustrated Introductory Unit G Using Forms to Control Input.
Dreamweaver MX. 2 Overview of Templates n Forms enable you to collect data from ______. n A form contains ________ such as text fields, radio buttons,
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Decision Making with Control Structures and Statements (non-audio version) © Dr. David.
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.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (there is an audio component to this eLesson) © Dr.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: HTML/XHTML Tables (NON-audio version) © Dr. David C. Gibbs
JavaScript Tutorial 1 - Introduction to JavaScript WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Introduction to JavaScript – A First.
Week 12 Working with Forms Objectives Understand how forms work Understand form syntax Create input objects Build forms within tables Build and.
HTML Forms. Slide 2 Forms (Introduction) The purpose of input forms Organizing forms with a and Using different element types to get user input A brief.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Windows (No audio component) © Dr. David C. Gibbs
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Variables, Functions and Events (NON-Audio version) © Dr. David C. Gibbs WDMD.
Form Processing Week Four. Form Processing Concepts The principal tool used to process Web forms stored on UNIX servers is a CGI (Common Gateway Interface)
HTML Forms.
Basic Webpage Design HTML Forms. Objectives Learn how to use HTML to create a form. Explain the concept of forms Know the difference of GET and POST Discuss.
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.
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.
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.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Chapter 5 Validating Form Data with JavaScript
Creating Forms on a Web Page
Presentation transcript:

WDMD 170 – UW Stevens Point 1 WDMD 170 Internet Languages eLesson: Working with Forms in JavaScript (NON-audio version) © Dr. David C. Gibbs

WDMD 170 – UW Stevens Point 2 Tutorial 6 Forms Section A - Working with Forms and Form Elements in JavaScript

WDMD 170 – UW Stevens Point 3 Tutorial 6A Topics Section A - Working with Forms in JavaScript –How to use HTML forms –About the submission of forms –How to use the tag –About form elements –How to create and use input fields button, checkbox, password, radio, reset, submit, text –How to create selection lists –How to create multiline text fields

WDMD 170 – UW Stevens Point 4 Overview of Forms What is a “Form?” –Here is an example we will use in this eLesson (please note that this code has been modified from Gosselin’s version – save it in your working Tutorial06 folder) Customer Information Forms are used to collect information for some subsequent processing –Information may be used for some further interaction with the Web page or be sent to a server for processing Server processing may include CGI, ASP, ISPI, etc. Server processing may also include interaction with a DB

WDMD 170 – UW Stevens Point 5 The “submission” of forms Typically, forms are sent to a server for processing. Server processing may include CGI, ASP, ISPI, etc. This course is not concerned with server-side processing. We will imitate submission to a server by opening another window and displaying the form fields. –Example: testFormSubmission.htmtestFormSubmission.htm You may copy and paste the code into your pages containing forms. The example shown above and the external.JS file to open the window are available for download: –FormSubmission.zipFormSubmission.zip Your task will be to implement the imitated form submission in your own pages.

WDMD 170 – UW Stevens Point 6 The Common Gateway Interface Gosselin describes the use of CGI for form processing. See Pages for more information. You are not responsible for CGI processing in this course.

WDMD 170 – UW Stevens Point 7 The Tag Designates a form within an HTML document and contains all text and tags that make up the form Multiple forms can be included in a document –Forms cannot be nested

WDMD 170 – UW Stevens Point 8 Example with two forms

WDMD 170 – UW Stevens Point 9 Example with two forms cont’d.

WDMD 170 – UW Stevens Point 10 Output of example with two forms

WDMD 170 – UW Stevens Point 11 Attribute s of the Tag

WDMD 170 – UW Stevens Point 12 The tag For more background on the tag, see Musciano Section 9.2 (pages ). NOTE: some of this reading is challenging! Scan it now so you know what’s there, and can refer back to it later.

WDMD 170 – UW Stevens Point 13 Form Elements: An Overview There are three tags used within tag pair to create form elements: – Used to create input fields that users can interact with. – Displays choices in a drop-down menu or scrolling list known as a selection list. – Used to create a text field in which users can enter multiple lines of information.

WDMD 170 – UW Stevens Point 14 Input Fields The tag is used to create input fields that use different types of interface elements to gather information Attributes are available to characterize the input field The tag and its attributes are described very nicely in Musciano Section 9.5 starting on page 323.

WDMD 170 – UW Stevens Point 15 Attribut es of the tag

WDMD 170 – UW Stevens Point 16 Input Fields: Gosselin Example <form action=“ method=“post” name=“exampleForm”> Name Address

WDMD 170 – UW Stevens Point 17 Input Fields: Gosselin Example cont’d. City, State, Zip

WDMD 170 – UW Stevens Point 18 Output of Gosselin Example tags

WDMD 170 – UW Stevens Point 19 Input Fields: Customer Example From the Customer Information example:Customer Information Name Address City, State, Zip Enter a password that you will need when you call technical support

WDMD 170 – UW Stevens Point 20 text boxes An tag with type = “text” –The user is allowed to type in the text field, which is accepted as the field’s value Can include attributes –NAME, VALUE, MAXLENGTH and SIZE Example: Name

WDMD 170 – UW Stevens Point 21 Simple Form Submission Simple Form Submission Simple Form Submission using external JS code Click submit to imitate form "submission". 15.<!-- the onsubmit handler calls the JS code to open the window and 16. display the form's fields --> A single text field: SimpleFormSubmission.htm

WDMD 170 – UW Stevens Point 22 Output of SimpleFormSubmission.htm

WDMD 170 – UW Stevens Point 23 Complete Exercise #2 in Tutorial 06A in Gosselin. Add the code to imitate form submission as shown on the previous two slides. Save your file as SimpleForm.htm in your Tutorial06 folder. eTask 1

WDMD 170 – UW Stevens Point 24 password boxes An tag with type = “password” –Each character the user types in the text field shows up as an asterisk (*) to hide it from onlookers Can include other attributes –NAME, VALUE, MAXLENGTH and SIZE

WDMD 170 – UW Stevens Point 25 password boxes: Example Example: Enter a password that you will need when you call technical support

WDMD 170 – UW Stevens Point 26 radio buttons An tag with type = “radio” Used to create a group of buttons from which only one button can be selected Can specify a default value using the CHECKED attribute Only one name=value pair is submitted with form data

WDMD 170 – UW Stevens Point 27 radio buttons: Example Example: What platform do you use? Windows 2000 Windows 95/98 Windows NT Windows ME UNIX Macintosh

WDMD 170 – UW Stevens Point 28 check boxes An tag with type = “checkbox” Used to create a box that can be set to yes (checked) or no (unchecked) Can specify default state using CHECKED attribute Only name=value pair from checked boxes is submitted with form data Can be grouped (although not mutually exclusively)

WDMD 170 – UW Stevens Point 29 check boxes: Example Example: What types of software do you use? (check all that apply) Word Processing Spreadsheets Database Graphics/CAD Programming

WDMD 170 – UW Stevens Point 30 reset buttons An tag with type = “reset” Clears all form entries and resets each form element to its initial value specified by the VALUE attribute Default label (Reset) appears if the VALUE attribute is not included Example:

WDMD 170 – UW Stevens Point 31 reset buttons: Example You may wish to allow the user a chance to confirm before resetting the entire form. Examine this behavior by clicking the reset button in the Customer Information example.Customer Information Clicking the reset button triggers the “reset” event, handled by the form using the “onReset” event handler. (See the red text below!) For example, add the following function in the and the onReset event handler to the tag: function confirmReset() { var resetForm = confirm("Are you sure you want to reset the form?"); if (resetForm == true) return true; else return false; }

WDMD 170 – UW Stevens Point 32 submit buttons An tag with type = “submit”. Default label (“Submit Query”) appears if the VALUE attribute is not included. Submits the form to the page specified by the action attribute of the form tag. Since we don’t submit to a server, we will make use of the submit event, handled by the form’s onSubmit event handler. This behavior was already seen in the SimpleFormSubmission.htm example. SimpleFormSubmission.htm

WDMD 170 – UW Stevens Point 33 submit buttons: Example Note: in Tutorial 06B we will “intercept” the submission in order to validate the field’s data values.

WDMD 170 – UW Stevens Point 34 command buttons An tag with type = “button” Use an onClick event handler to execute JavaScript code that performs some operation (e.g., a calculation, or some action.) An example of this use is in the pop-up window that displays the form fields.

WDMD 170 – UW Stevens Point 35 command buttons: Example

WDMD 170 – UW Stevens Point 36 image submit buttons An tag with type = “image” Displays a graphical image and submits the form to a CGI script on a server Use SRC attribute to specify image to be displayed on the button

WDMD 170 – UW Stevens Point 37

WDMD 170 – UW Stevens Point 38 selection lists Creates a selection list that presents users with fixed lists of values from which to choose (also known as “drop-downs”). Can appear as: –List of choices (size=‘n’) –Drop-down menu (size=1 or excluding size) Can also have a scroll bar.

WDMD 170 – UW Stevens Point 39

WDMD 170 – UW Stevens Point 40

WDMD 170 – UW Stevens Point 41 selection lists: example Where will you use this product? Work School Home Home Office

WDMD 170 – UW Stevens Point 42 selection lists: example 2 Where will you use this product? Work School Home Home Office

WDMD 170 – UW Stevens Point 43 Multiline Text Fields tag is used to create a field in which users can enter multiple lines of information Known as: –Multiline text fields –Text areas

WDMD 170 – UW Stevens Point 44 Summary Working with Forms in JavaScript How to implement HTML forms About the submission of forms How to use the tag About form elements –button, checkbox, password, radio, reset, submit, text How to create selection lists How to create multiline text fields

WDMD 170 – UW Stevens Point 45 Assignment Complete exercises #2 (eTask1), 3, and 5 on pages of Gosselin, Tutorial 06A. NOTE: for exercises 2, 3, and 5, implement the form submission strategy shown in SimpleFormSubmission.htm.SimpleFormSubmission.htm Post your solutions to your Tutorial06 folder CISSRV5 server. Create a first attempt at a form for your project. Eventually you must include all the form fields required in the project specs document. Save the file as projectForm1.htm.project specs document Add a link in the discussion forum for your project’s form along with any questions or problems you experienced. You may also post any questions (and the exercise file) to the eReview group – for discussion purposes.

WDMD 170 – UW Stevens Point 46 End of eLesson Jump to the Beginning of this eLesson WDMD 170 Course Schedule D2L Courseware Site