Lesson 8 Creating Forms with JavaScript

Slides:



Advertisements
Similar presentations
The Web Wizards Guide To JavaScript Chapter 3 Working with Forms.
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?
Dreamweaver Forms Overview. Forms – A Little Review Most user/webpage communication is one way, like this: Most user/webpage communication is one way,
1 Lesson 5 Introduction to Cascading Style Sheets HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
1 Lesson 9 Using JavaScript with Frames HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
The Web Warrior Guide to Web Design Technologies
1 Topic 6 Processing Form Input. 2Outline Goals and Objectives Goals and Objectives Chapter Headlines Chapter Headlines Introduction Introduction Form.
1 Lesson 10 Using JavaScript with Styles HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
FORMs Lesson TBE 540. Prerequisites Before beginning this lesson, the learner must be able to… –Create basic web pages using a text editor and/or a web.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
JavaScript Forms Form Validation Cookies CGI Programs.
Computer Science 103 Chapter 4 Advanced JavaScript.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
CST JavaScript Validating Form Data with JavaScript.
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.
CNIT 133 Interactive Web Pags – JavaScript and AJAX JavaScript forms.
JavaScript Form Validation
JS: DOM Form Form Object Form Object –The Form object represents an HTML form. –For each instance of a tag in an HTML document, a Form object is created.
Department of Information Technology e-Michigan Web Development 0 HTML Form Creation in the Vignette Content Management Application.
Database-Driven Web Sites, Second Edition1 Chapter 8 Processing ASP.NET Web Forms and Working With Server Controls.
Chapter 3 Using Validation Controls. What is a Validation Control? A control that validates the value in another control Renders as an HTML tag with an.
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.
McGraw-Hill/Irwin © 2004 by The McGraw-Hill Companies, Inc. All rights reserved. Dynamic Action with Macromedia Dreamweaver MX Barry Sosinsky Valda Hilley.
10 Adding Interactivity to a Web Site Section 10.1 Define scripting Summarize interactivity design guidelines Identify scripting languages Compare common.
JavaScript Lecture 6 Rachel A Ober
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
Adding User Interactivity – Lesson 51 Adding User Interactivity Lesson 5.
1 Lesson 7 Using Images with JavaScript HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
TUTORIAL 10: PROGRAMMING WITH JAVASCRIPT Session 3.
1 Lesson 3 Power Techniques HTML and JavaScript BASICS, 4 th Edition Barksdale / Turner.
G053 - Lecture 16 Validating Forms Mr C Johnston ICT Teacher
© 2010 Delmar, Cengage Learning Chapter 8 Collecting Data with Forms.
Using Client-Side Scripts to Enhance Web Applications 1.
1 Forms and Form elements CSD 340 McCoey. 2 Form Object Properties action Usually a call to a server elements encoding method post or get target Methods.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
CO1552 Web Application Development HTML Forms, Events and an introduction to JavaScript.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
HTML and FORMS.  A form is an area that can contain form elements.  Form elements are elements that allow the user to enter information (like text fields,
Button and Textbox. Input  Input objects are used to obtain input from the user viewing the webpage. They allow the user to interact with the Web. 
HTML Form Widgets. Review: HTML Forms HTML forms are used to create web pages that accept user input Forms allow the user to communicate information back.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
JavaScript, Fourth Edition
The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms.
The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms.
Form Components and Elements
Unit 10 – JavaScript Validation Instructor: Brent Presley.
Event Handling. Objectives Using event handlers Simulating events Using event-related methods.
HTML FORMS The TEXT Object Presented By: Ankit Gupta.
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.
Unit 2 — The Exciting World of JavaScript Lesson 7 — Creating Forms with JavaScript.
Lesson 16. Practical Application 1 We can take advantage of JavaScript and the DOM, to set up a form so that the first text box of a form automatically.
LESSON : EVENTS AND FORM VALIDATION -JAVASCRIPT. EVENTS CLICK.
Chapter 5 Introduction To Form Builder. Lesson C Objectives  Use sequences to automatically generate primary key values in a form  Create lists of values.
JavaScript Events Java 4 Understanding Events Events add interactivity between the web page and the user You can think of an event as a trigger that.
Learning Aim C.  In this section we will look at how text, tables, forms and frames can be used in web pages.
JavaScript Events. Understanding Events Events add interactivity between the web page and the user Events add interactivity between the web page and the.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
JavaScript, Third Edition 1 SELECTION LIST Demo. JavaScript, Third Edition 2 Description This web page will edit the slection to ensure an option was.
Client-side (JavaScript) Validation. Associating a function with a click event – Part 1 Use the input tag’s onclick attribute to associate a function.
JavaScript, Sixth Edition
Chapter 5 Validating Form Data with JavaScript
Web Programming– UFCFB Lecture 17
Event Driven Programming & User Defined Functions
The Web Wizard’s Guide To JavaScript
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

Lesson 8 Creating Forms with JavaScript HTML and JavaScript BASICS, 4th Edition Barksdale / Turner

Objectives Create an HTML form. Make a form submission button functional. Make a form clearing button functional. Validate text fields with JavaScript. Validate radio buttons with JavaScript. 2

Vocabulary check box components controls data validation radio button text field 3

Making HTML Forms More Functional Start by defining the general layout of the form on a Web page using HTML tags. Identify the various objects in the HTML form with which the users interact. Name each of these interactive objects (also called controls or components). Write the JavaScript functions invoked when the user triggers a specific JavaScript event. 4

Making HTML Forms More Functional (continued) Data validation is the process of checking user input data to make sure that it is complete and accurate. There are many kinds of mistakes, such as missing data, which can be detected by JavaScript. 5

Creating a Pizza Order Form The first step in creating an effective order form for the JavaScript Pizza Parlor is to define its appearance on the Web page with the appropriate HTML tags. Pay close attention to the name attribute used in the HTML tags. Although the names do not affect the form appearance, they are critical elements of the document. 6

Creating a Pizza Order Form (continued) Text field: Input control that allows the user to enter a string value into a specific location on the Web page. Radio button (option button): Input control that allows the user to select just one option from a set of options. Check box: Input control that allows the user to select any number of options from a set of options. 7

Creating a Pizza Order Form (continued) You can use text fields, radio buttons, and check boxes within the same form. Pizza Order Form 8

Creating a Pizza Order Form (continued) A string is a sequence of one or more characters, and can consist of a single word, a complete sentence, or an entire chapter of a book. Normally, strings contain meaningful text, but this is not a requirement. 9

Making the Submit Order Button Functional To start, add a JavaScript function that will be called when the user clicks the Submit Order button. In this case, you enter a doSubmit() function that invokes the alert() method. To get the Submit Order button to call a JavaScript function when it is clicked, you use an event called onClick. 10

Making the Submit Order Button Functional (continued) It is important to give users feedback and to let them know their order has been processed. Web page with Submit Order button clicked 11 11

Making the Clear Entries Button Functional You can build features into forms to make it easy for people to correct their errors. Add the doClear() function. Add an onClick event to the <input> tag of the Clear Entries button. This event will call the doClear() function to erase any existing form data. 12 12

Validating Text Fields The validateText() function can only return one of two possible values: false or true. The false value is returned if the value property of an object is an empty string. If none of the required text fields are blank, meaning a user entered something in each of the fields, the function returns the true value. 13 13

Validating Text Fields (continued) The DoSubmit() function evaluates the validateText() function and displays an alert box if information is missing. Data validation – text fields 14 14

Validating Radio Buttons To validate a set of radio buttons, you need to test the value of each object’s checked property to see if it is set to true or false. The validateRadio() function returns a true value if it encounters a selected radio button. However, if none of the radio buttons in the set is selected, the function returns a false value. 15 15

Summary In this lesson, you learned: How to create an HTML form. How to make a form submission button functional. How to make a form clearing button functional. How to validate text fields with JavaScript. How to validate radio buttons with JavaScript. 16