Chapter 14 The HTML Tag <FORM NAME = " form name " opt ACTION = " URL " opt METHOD = "POST | GET" opt ENCTYPE = " mimeType " opt TARGET = " Target Page.

Slides:



Advertisements
Similar presentations
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?
Advertisements

Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
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.
Forms cs105. More Interactive web-pages So far what we have seen was to present the information. (Ex: tables. Lists,….). But it is not enough. We want.
Chapter 7 © 2001 by Addison Wesley Longman, Inc. 1 Chapter 7 Sebesta: Programming the World Wide Web.
JavaScript Forms Form Validation Cookies CGI Programs.
Personal Independent Networking Project HTML Forms by Chris Smith.
USER INTERACTIONS: FORMS
Lesson 2 Event Handling. Object Event Handlers Most of the objects that make up the Document Object Model respond to asynchronous, user generated events.
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.
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.
Forms and Form Controls Chapter What is a Form?
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
225 City Avenue, Suite 106 Bala Cynwyd, PA , phone , fax presents… HTML Lists, Tables and Forms v2.0.
Copyright ©2005  Department of Computer & Information Science Introducing DHTML & DOM: JavaScript & Forms.
Robinson_CIS_285_2005 HTML FORMS CIS 285 Winter_2005 Instructor: Mary Robinson.
CSS Class 7 Add JavaScript to your page Add event handlers Validate a form Open a new window Hide and show elements Swap images Debug JavaScript.
Lecture # 6 Forms, Widgets and Event Handling. Today Questions: From notes/reading/life? Share Personal Web Page (if not too personal) 1.Introduce: How.
Using Client-Side Scripts to Enhance Web Applications 1.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
Dreamweaver MX. 2 Overview of Templates n Forms enable you to collect data from ______. n A form contains ________ such as text fields, radio buttons,
FORMS. Forms are used to receive information from the web surfer, such as: their name, address, credit card, etc. Form fields are objects that allow.
Lecture 10 JavaScript: DOM and Dynamic HTML Boriana Koleva Room: C54
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.
Lecture # 10 JavaScript Programming II. Today Questions: From notes/reading/life? Review Homework # 2 1.Introduce: How make widgets work with JavaScript?
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.
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.
Fluency with Information Technology INFO100 and CSE100 Katherine Deibel Katherine Deibel, Fluency in Information Technology1.
Client-Side programming with JavaScript 2. Event-driven programs and HTML form elements event-driven programs  onload, onunload  HTML forms & attributes.
Introduction To HTML Form Inputs Written By George Gimian.
Chapter 19 Creating and Processing HTML Forms. How HTML Forms Transmit Data name1=value1&name2=value2...&nameN =valueN GET or POST GET, an HTTP GET request,
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.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
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.
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.
1 Committed to Shaping the Next Generation of IT Experts. 03: Links and Forms HTML.
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
JavaScript Event Handlers. Introduction An event handler executes a segment of a code based on certain events occurring within the application, such as.
CSC 121 Computers and Scientific Thinking Fall Event-Driven Programming.
SE-2840 Dr. Mark L. Hornick 1 Dynamic HTML Handling events from DOM objects.
Methods and Object Information. Some Document Methods.
Chapter 4 Java Script – Part2. 2 Location object Properties Properties href – whole path will be displayed. ex: window.location.href ( see example 11)
XHTML Forms.
HTML Again GUI Items Originally HTML 4 Copyright © Curt Hill.
5.1 JavaScript Execution Environment
Chapter 5 Validating Form Data with JavaScript
JavaScript and HTML Simple Event Handling 11-May-18.
In this session, you will learn to:
How to Write Web Forms By Mimi Opkins.
Forms Web Design Ms. Olifer.
(and available form fields)
JAVASCRIPTS AND HTML DOCUMENTS
Web Systems Development (CSC-215)
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.
CHAPTER 7 JavaScripts & HTML Documents
© 2015, Mike Murach & Associates, Inc.
Events: Changed and Input
JavaScript and Forms Kevin Harville.
JavaScript and Ajax (JavaScript Events)
JavaScript and HTML Simple Event Handling 26-Aug-19.
JavaScript and HTML Simple Event Handling 4-Oct-19.
Presentation transcript:

Chapter 14 The HTML Tag <FORM NAME = " form name " opt ACTION = " URL " opt METHOD = "POST | GET" opt ENCTYPE = " mimeType " opt TARGET = " Target Page or Frame " opt onSubmit = " eventHandler " opt onReset = " eventHandler " opt > formElement formElement n The form attributes are optional for most JavaScript programs.

Chapter 14 Text Fields <INPUT TYPE = "text" NAME = " Field Name " VALUE = " Field Contents " opt SIZE = " Columns in Use " opt MAXLENGTH = " Maximum Columns " opt onBlur = " Event Handler " opt onFocus = " Event Handler " opt onSelect = " Event Handle r" opt onChange = " Event Handler " opt > Text Fields are created with an tag.

Chapter 14 Text Fields A text field contains a single line of text into which the user places information.

Chapter 14 Buttons <INPUT TYPE = ”button" NAME = ” Button Name " VALUE = ” Label Name " opt onClick = " Event Handler " opt > Buttons are also created with an tag.

Chapter 14 Buttons A button is frequently used to signal completion of a form. The user simply clicks the button.

Chapter 14 The First Form Page <INPUT TYPE = "text" NAME = "yourName" SIZE = "10"> <INPUT TYPE = "button" VALUE = "Done" onClick = "check(this.form)"> The form for the First Form page. The check() function implements the event handler for the button.

Chapter 14 The check() Function function check(form) {//validate a text form if (form.elements[0].value == "") { alert("You didn't enter your name."); form.yourName.focus(); form.yourName.select(); return; } document.write("Glad to meet you, " + form.yourName.value + ". "); }

Chapter 14 Text Area <TEXTAREA NAME = " Text Area Name " ROWS = " Number Of Rows " opt COLS = " Number Of Columns " opt WRAP = "off" | "physical" |"virtual" opt onBlur = " Event Handler " opt onFocus = " Event Handerl " opt onChange = " Event Handler " opt onSelect = " Event Handler " opt > Place default text here A Text Area uses its own set of tags.

Chapter 14 The Text Area Page The Text Area page copies the text from the first area into the second. The user may also clear both areas.

Chapter 14 The First Form Page <TEXTAREA NAME = "Original" ROWS = "4" COLS = "20"> <INPUT TYPE = "button" VALUE = "Copy" onClick = "copy(this.form)"> <INPUT TYPE = "button" VALUE = "Clear” onClick = "clean(this.form)"> The text areas and buttons are actually placed in a table. This slide only illustrates the tags. The copy and clean buttons change the text areas.

Chapter 14 The copy() Function function copy(form) {//copy from original to copy form.Copy.value = form.Original.value; } The copy() function uses the value property of the textarea object to copy the contents of the first text area.

Chapter 14 The First Form Page function clean(form) {//clean the text areas form.Original.value = ""; form.Copy.value =""; form.Original.select(); form.Original.focus(); } The clean() method clears both text areas. The value properties are set to the null string.

Chapter 14 The clean() Function function clean(form) {//clean the text areas form.Original.value = ""; form.Copy.value =""; form.Original.select(); form.Original.focus(); } The select() and focus() methods put the blinking cursor in the first text area.

Chapter 14 Radio Buttons Radio Buttons are used when the user may select only a single button in a set of buttons.

Chapter 14 Radio Buttons Radio buttons are created with an tag. <INPUT TYPE = "radio" NAME = " Button Group " VALUE = " Button Value " opt CHECKED opt onClick = " Event Handler " opt >Label

Chapter 14 Radio Buttons JavaScript is used to generate the radio buttons. The Label array is created in a JS script in the head of the page. for (var i=0; i < Label.length; i++) {//use Label array to generate buttons document.write("<INPUT TYPE = 'radio' NAME = 'web'"); document.write("onClick = 'getPage(this.form)'>"); document.write(Label[i] + " "); }

Chapter 14 Radio Buttons The getPage() function implements the event handler for a button click. The if statement loads the URL into the right frame of the page. The URL array is created in a script in the head of the page. function getPage(form) { //get the page and jump to it for (var i=0; i < form.web.length; i++) if (form.web[i].checked) parent.frames[1].location.href = URL[i]; }

Chapter 14 Check Boxes Check boxes let the user select none, one, or several check boxes.

Chapter 14 Check Boxes Check boxes are created with an tag. <INPUT TYPE = "checkbox" NAME = " Box Name " VALUE = " Box Value " opt CHECKED opt onClick = " Event Handler " opt > Label

Chapter 14 Check Boxes JavaScript is used to generate the check boxes. The colors array is created in a JS script in the head of the page. for (var i = 0; i < colors.length; i++) {//create the check boxes using colors document.write(" <INPUT TYPE = “ + “'checkbox' NAME = '"); document.write(colors[i] + "'> "); document.write(colors[i] + " "); }

Chapter 14 Check Boxes The process() function creates a string corresponding to the checked boxes. The string is written to the Output text area. function process(form) { form.Output.value = form.Output.defaultValue = outputString; for (var i = 0; i < colors.length; i++) if (form.elements[i].checked) form.Output.value = form.Output.value + "\n" + colors[i]; }

Chapter 14 Select List A Select List can mimic either a set of radio buttons or check boxes. They are used for long lists of alternatives. Select lists use two types of tags. … create the list. creates the alternatives.

Chapter 14 Select Lists <SELECT NAME = " Select Name " SIZE = " List Size " opt MULTIPLEopt onBlur = " Event Handler" opt onFocus =" Event Handler " opt onChange = " Event Handler " opt > Label... Label

Chapter 14 Select Lists Chocolate Hot Fudge Strawberry Caramel Butterscotch Cookie Dough M and M's Crushed Butterfingers This single select list lets the user select only one topping.

Chapter 14 Select Lists red white blue green yellow orange violet pink This multiple select list lets the user select several colors.

Chapter 14 The Shakespearean quiz s the user’s selections.

Chapter 14 <FORM NAME = "brushUP" METHOD = "POST" ACTION = ENCTYPE = "text/plain"> When ing form information, we use the POST method. The ACTION attribute contains the address. The encryption is set to plain text.