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.

Slides:



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

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.
JavaScript Forms Form Validation Cookies. What JavaScript can do  Control document appearance and content  Control the browser  Interact with user.
Video, audio, embed, iframe, HTML Form
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.
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.
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.
1 CS101 Introduction to Computing Lecture 12 Interactive Forms (Web Development Lecture 4)
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
CST JavaScript Validating Form Data with JavaScript.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
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.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration Form.
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.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
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.
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.
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,
SYST Web Technologies SYST Web Technologies XHTML Forms.
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.
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.
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
XHTML Forms.
Tutorial 6 Working with Web Forms
Chapter 5 Validating Form Data with JavaScript
Client-Side Internet and Web Programming
In this session, you will learn to:
How to Write Web Forms By Mimi Opkins.
Forms Web Design Ms. Olifer.
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)
HTML/XHTML Forms 18-Sep-18.
Designing Forms Lesson 10.
1.5 FORMS.
Objectives Explore web forms Work with form servers
Creating Form Elements
Creating Form Elements
Web Development & Design Foundations with H T M L 5
Forms Data Entry and Capture
CNIT 131 HTML5 - Forms.
Web Development & Design Foundations with H T M L 5
Creating Forms on a Web Page
Basics of Web Design Chapter 10 Form Basics Key Concepts
HTML Forms 18-Apr-19.
JavaScript and Forms Kevin Harville.
HTML Forms
Presentation transcript:

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 this processing, appropriate information from a web site can be dispatched to be viewed. Both the capturing of user input and the rendering of appropriate web pages takes place in the client side, browser’s window. Traditionally, user input is captured in a Form.

Form object JavaScript enabled browser, creates a ‘forms array’ in memory. This array tracks the number of form objects described in the HTML program. Each form object in the HTML page will be described between its own <FORM> ... </FORM> HTML tags. Should there be multiple forms (i.e. multiple occurrences of the <FORM> ... </FORM> tags) described in the HTML page then the forms array will have multiple (indexed) elements, each holding a reference to an HTML form object.

Form element array Index Value Form1.Element1 1 Form1.Element2 2 Form1.Element1 1 Form1.Element2 2 Form1.Element3 Index Value Form1 1 Form2 Index Value Form2.Element1 1 Form2.Element2 2 Form2.Element3 3 Form2.Element4 4 Form2.Element5 5 Form2.Element6

The JavaScript forms array also holds information about each object used within the <FORM> ... </FORM> tags. Common HTML objects used between the <FORM> ... </FORM> tags are Text, Text Area, Radio Buttons, Buttons, Check Boxes and so on.

Forms An HTML form is used extensively in creating interactive web pages. Using the associated arrays created by a JavaScript enabled browser and JavaScript code, all form elements (objects contained in the form) are accessible. Once accessible their properties can be manipulated so as to control the functionality of the form at run time

Once the reference to the form’s elements are known let us write a JavaScript procedure that will read the each Form’s Element array and return the names of the form elements held in the array. Example1

The Form Object’s Methods HTML forms can be made up of a variety of HTML elements that accept user input. The <FORM> </FORM> HTML tags enclose the HTML elements that make up the form. Once a JavaScript enabled browser encounters these tags in an HTML file the JavaScript enabled browser creates a form object in memory, which is held as an element of the forms array. The form object has properties like Name, Method and Action.

Method The Method property of a form is used to specify the method used to send data captured by various form elements back to the web server. The method used can be either Get or Post.

Get Method The Get method sends the data captured by form elements to the web server encoded into a URL, which points to a web server. The data captured in form elements is appended to the URL. This technique is used when there is a small amount of data being sent back to the web server. The maximum amount of data that can be sent back to the web server using this method is 1024 bytes.

Post Method The Post method sends the data captured by form elements back to the web server as a separate bit-stream of data. When there is a large amount of data to be sent back to the web server, this is the method used. If the method attribute is not specified within the <FORM> </FORM> tags, the default method used by the browser to send data back to the web server is the Get method, i.e. as an encoded URL.

Action The Action attribute of the <FORM>...</FORM> tags points to the URL (address) of a program on the web server that will process the form data captured and being sent back. The server side program that processes this data can be written in any scripting language that the web server understands.

HTML form elements Form Elements Description & Syntax Text A text field (<INPUT Type=”Text”>) Password A password text field in which each keystroke appears as an asterisk(*) (<INPUT Type=’Password”>) Button A new element that provides a button other than a submit or reset button (<INPUT Type=Button>) Checkbox A checkbox (<INPUT Type’Checkbox’>) Radio A radio button (<INPUT Type=’Radio”>) Reset A reset button (<INPUT Type=”Reset’>) Submit A submit button (<INPUT Type=”Submit”>) Select A selection list (<SELECT><OPTION>option 1</OPTION> <OPTION>option2</OPTION></SELECT>) TextArea A multi line text entry field (<TEXTAREA>Defaült Text</TEXTAREA>) Hidden A field that may contain a value but is not displayed within a form (<INPUT Type=’Hidden”>)

Each of these form elements can be named Each of these form elements can be named. Once named, their names can then be used for referencing them in JavaScript. ‘Name’ is a property associated with every HTML object used in a form.

JavaScript 5

The Text Element Properties The text object has the following properties: name and Value Methods The text object has the following methods: focus() blur() select() Events - Focus() BIur() Select() Change()

The Text Element JavaScript provides the following event handlers for the text objects events: onFocus() onBlur() onSelect() onChange() Syntax: - <INPUT Name”<NameOfTheObj ect>” Type=”Text” Value=”<DefaultValue>”> Example: <INPUT Name=”txt age” Type”Text” Value=” 18”>

The Password Element The password element is a unique type of text entry field. All keystrokes for this field are displayed as an asterisk [*]. Properties The password object has the following properties: . default Value, name, value

The Password Element Methods The password object has the following methods: . focus( ) blur( ) select ( ) Events The password object has the following methods: . Focus() Blur() Select() Change()

The Password Element JavaScript provides the following event handlers for the password object’s events: . onFocus() onBlur() onSelect() onChange() Syntax: <INPUT Name<NarneOfTheObj ect> Type=”Password” Value=”<Default Value>”> Example: <INPUT Name=”txt_usr_pswd” Type=”Password” Value=“”>

The Button Element Properties . Name value Method . click() Event . click() JavaScript provides the following event handler for the button object’s event: . onClick() Example4

The Submit (Button) Element Properties Name ,value Method . click() Event . click() JavaScript provides the following event handler for the Submit button’s event: . onClick( ). Example: <INPUT Name=’btn_submit” Type=”Submit” Value=”SUBMIT DATA”>

The Reset (Button) Element Properties name value Methods click() Events click() The reset button’s JavaScript event handler is: . onClick() Example5

The Checkbox Element Properties .name .value .checked Method . click() Event . on click() A checkbox’s JavaScript event handler is: . onClick() Example 6

The Radio Element Properties . Checked . Index . length . name Method . clicked() Event . Clicked() A radio button’s JavaScript event handler is: onClicked() Example 7

The TextArea Element Pronerties name, value Methods: Focus() Blur() Select() Events: o Focus() Blur() Select() The Javacript eventhandlers of a TextArea are: onFocus() onBlur() onSelect( )

The TextArea Element Syntax: <INPUT TYPE=TextArea Name”<MyTextArea>” Row=1O Cols=25> <H2>Enter Data Here</H2></TEXTAREA>

Select And Option Elements A Select object on an HTML form appears as drop-down list or a scrollable list of selectable items.

Multi Choice Select Lists To use a Select object, from which multiple choices can be made from within the list the MULTIPLE attribute must be set in the select object. Example8