The Web Wizard’s Guide To JavaScript

Slides:



Advertisements
Similar presentations
17 HTML, Scripting, and Interactivity Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and.
Advertisements

The Web Wizards Guide To JavaScript Chapter 3 Working with Forms.
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.
Dreamweaver Forms Overview. Forms – A Little Review Most user/webpage communication is one way, like this: Most user/webpage communication is one way,
CIS101 Introduction to Computing Week 08. Agenda Your questions JavaScript text Resume project HTML Project Six This week online Next class.
Creating a Form on a Web Page
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Web Database Programming Input Validation. User Input on the Web Web browser built-in mechanisms –HTML Forms HTTP POST method –Hyperlinks HTTP GET method.
JavaScript Forms Form Validation Cookies CGI Programs.
Lesson 8 Creating Forms with JavaScript
CST JavaScript Validating Form Data with JavaScript.
XP Tutorial 14 New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Working with Forms and Regular Expressions Validating a Web Form with JavaScript.
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.
HTML Forms What is a form.
HTML Forms/Events (Instructor Lesson) The Event model HTML Forms Custom Events 1.
Introduction to Programming the WWW I CMSC Summer 2003 Lecture 12.
The Web Wizard’s Guide To JavaScript Chapter 1 JavaScript Basics.
Copyright ©2005  Department of Computer & Information Science Introducing DHTML & DOM: Form Validation.
Server vs Client-side validation. JavaScript JavaScript is an object-based language. JavaScript is based on manipulating objects by modifying an object’s.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
WEEK 3 AND 4 USING CLIENT-SIDE SCRIPTS TO ENHANCE WEB APPLICATIONS.
Copyright ©2005  Department of Computer & Information Science Introducing DHTML & DOM: JavaScript & Forms.
JavaScript II ECT 270 Robin Burke. Outline JavaScript review Processing Syntax Events and event handling Form validation.
Integrating JavaScript and HTML5 HTML5 & CSS 7 th Edition.
Section 17.1 Add an audio file using HTML Create a form using HTML Add text boxes using HTML Add radio buttons and check boxes using HTML Add a pull-down.
HTML Concepts and Techniques Fourth Edition Project 7 Creating a Form on a Web Page.
Using Client-Side Scripts to Enhance Web Applications 1.
Introduction to JavaScript 41 Introduction to Programming the WWW I CMSC Winter 2004 Lecture 17.
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.
Microsoft FrontPage 2003 Illustrated Complete Creating a Form.
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.
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
1 CSC160 Chapter 7: Events and Event Handlers. 2 Outline Event and event handlers onClick event handler onMouseOver event handler onMouseOut event handler.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
HTML5 Forms Forms are used to capture user input …
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.
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.
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.
Learning Aim C.  In this section we will look at how text, tables, forms and frames can be used in web pages.
HTML Structure II (Form) WEEK 2.2. Contents Table Form.
Ashima Wadhwa Java Script And Forms. Introduction Forms: –One of the most common Web page elements used with JavaScript –Typical forms you may encounter.
Dynamic Web Authoring form validation (1) COM311H Zheng, School of C&M, UUJ1.
JavaScript, Sixth Edition
Chapter 5 Validating Form Data with JavaScript
In this session, you will learn to:
Web Development & Design Foundations with HTML5
Section 17.1 Section 17.2 Add an audio file using HTML
Web Programming– UFCFB Lecture 17
Working with Forms and Regular Expressions
Integrating JavaScript and HTML
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.
The Web Wizard’s Guide To JavaScript
© 2015, Mike Murach & Associates, Inc.
Creating Forms on a Web Page
JavaScript and Forms Kevin Harville.
The Web Wizard’s Guide To JavaScript
CHAPTER FOUR VARIABLES AND CONSTANTS
Murach's JavaScript and jQuery (3rd Ed.)
Murach's JavaScript and jQuery (3rd Ed.)
Presentation transcript:

The Web Wizard’s Guide To JavaScript Chapter 3 Working with Forms

Chapter Objectives To learn how to use form validation to examine the text entered by your visitors To understand the principles of working with text fields To learn how to detect and change the format of information in a text field To learn how to work with radio buttons, check boxes, and selection menus To create simple self-grading tests

Form Validation HTML forms contain fields, select menus, radio buttons, and check boxes Form validation procedures: Check the data the visitor enters on the form Reminds the visitor to enter missing data Reformats the visitor’s data as needed

Text Fields: Bad or Missing Data The <input> tag - single line of text The <textarea> tag - multiple lines of text Always include name and value attributes The onsubmit event handler calls the validate() function The validate() function checks for bad or missing data. If the function returns false then the form is not submitted.

Text Fields: Reformatting Data U.S. telephone numbers require specific format (555) 333-4444 A visitor types a phone number into a text field then types the tab key. An onchange event handler calls the formatNumber() function. The formatNumber() function finds the first ten numbers in the text field and adds the necessary parentheses and spaces. The reformatted number is displayed in the field.

Validating Text Fields To validate a text field, you first determine whether a value has been entered. For example, to determine whether the visitor neglected to enter information into a required field, you may test the expression (!document.survey.visitor.value). If that expression is true then the visitor failed to enter required information into the visitor field.You can also check to make sure the information is in the correct format in terms of numbers and punctuation.

Radio Buttons Radio buttons are used for questions like gender which have a limited number of possible responses. The getRadioValue() function finds the value of the checked radio button. The showRadioValue() function checks the desired radio button. Place these functions in your code library.

Validating Radio Buttons Browsers automatically store a set of radio buttons, all bearing the same name, in an array. For example, if you have two radio buttons called gender, the first one, gender[0], might have a value of male and the second one, gender[1], might have a value of female. You can use JavaScript expressions to see which button is checked and to find its value.

Check Boxes Check boxes for “check all that apply” questions. When form is submitted, names and values of checked boxes are sent Test for the checked property Often it is helpful to use sequential names for check boxes (q1, q2, q3).

Selection Menus <select> tag creates a popup selection menu with options set in the <option> tag Select and go navigation The getSelectValue() function finds the value of the selected option. The showSelectValue() function changes to the display of a <select> to a given value. Store these functions in your code library.

Validating Selection Menus A common technique for obtaining the value of a selected item in a SELECT menu is to store the SELECT object in a variable, find the number of the selected option (the selectedIndex property), and then find the value of the selected option.

Self-grading Tests Forms are often used for self-grading tests. Students receive feedback on their responses.