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.

Slides:



Advertisements
Similar presentations
Computer and Communication Fundamental Basic web programming Lecture 8 Rina Zviel-Girshin.
Advertisements

1 Introduction to HTML II อุทัย เซี่ยงเจ็น สำนักวิชาเทคโนโลยีสารสนเทศ และการสื่อสาร มหาวิทยาลัยนเรศวร พะเยา.
>> Introduction to HTML: Forms. Introduction to HTML 5 Important HTML Tags HTML tags and attributes Images Hyperlinks Lists –{ordered | unordered | definition}
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.
Computing Concepts Advanced HTML: Tables and Forms.
Forms and JavaScript CS105. Introduction We want to write an html page for a Pizza shop for getting order from customers online.
CGI Programming: Part 1. What is CGI? CGI = Common Gateway Interface Provides a standardized way for web browsers to: –Call programs on a server. –Pass.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
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.
Application Development Description and exemplification of server-side scripting language for server connection, database selection, execution of SQL queries.
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.
HTML Forms What is a form.
CO1552 Web Application Development HTML Forms. Websites can be made more interactive by providing facilities for users to provide data To get user entered.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
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.
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.
Suzanne J. Sultan Javascript Lecture 2. Suzanne J. Sultan function What is a function> Types of functions:  Function with no parameters  Function with.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
Lecture # 6 Forms, Widgets and Event Handling. Today Questions: From notes/reading/life? Share Personal Web Page (if not too personal) 1.Introduce: How.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
Forms and Server Side Includes. What are Forms? Forms are used to get user input We’ve all used them before. For example, ever had to sign up for courses.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
IDK0040 Võrgurakendused I harjutus 05: Forms Deniss Kumlander.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
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,
HTML FORMS GET/POST METHODS. HTML FORMS HTML Forms HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes,
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
HTML Form. HTML forms are used to collect user input. The element defines an HTML form: Form elements are different types of input elements, checkboxes,
HTML FORMS Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1.
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.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
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.
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.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
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.
Section 17.1 Section 17.2 Add an audio file using HTML
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Designing Forms Lesson 10.
HTML: Basic Tags & Form Tags
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.
Creating Forms on a Web Page
HTML: Basic Tags & Form Tags
Presentation transcript:

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 to design web-pages that are more interactive. Pages that – get the data from user (input). – Process data. – Return the result (output). A two way communication.

Forms Form is an area in your web-page which can contain form elements. This area is specified by tags. Form-elements are elements that allow the web-page to get data from user by providing graphical interfaces to the users to enter their data.

Form-Elements Text Field Text Area Check box Radio buttons Buttons (Reset, submit,…) Dropdown boxes And more... Example

Any standard HTML element (except another ) can be contained within – Attributes: NAME = “name” and ACTION =“url” NAME: Name the form (For tasks related to user input data processing ) ACTION: The URL of the program that will process the data when the form is submitted.

Form-Elements : Specifies the type of graphical interface to get the data from user. Attributes: – TYPE: text radio checkbox button reset submit Password... – NAME: names this element.

Text Field A single line field which is used when you want the user to type letters, numbers, etc. in a form. Example: NAME: Name given to this form element SIZE: The number of characters allowed in this text field. If you do not include this attribute, the text length will be 20 by default.

Example …. First Name

Do it yourself Write an HTML which contains three text fields, one for user’s name, one for user’s SSN and for the name of the user’s car. – Note that the length of your SSN is nine. So make the size of your text field 9 using size attribue. Name your file forms.html. – The default value of the car text field should be “noCar”. You can specify this using VALUE attribute of input element: VALUE = “noCar”. – The title of the page should be: Example’s of form elements View the result with a web browser.

Processing Data After the web page receives the data (input) from the client of the web page by some means such as a form elements, it needs to be processed. There are two possible location for processing data – The data can be sent thru network to a web-server machine where all such processing requests are processed. Then the result will be sent to the client machine which initiated the request by opening a page and filling some sort of forms. – The data can be processed at client machine by some tiny programs embedded in the web page. These tiny programs are sent to client side along the web page when the user loads the web page.

Scripts Scripts are these tiny programs within the web page. (inside HTML). They are List of instructions for processing data presented on the page in a variety of ways such as the data submitted using some kind of form element. This data processing by mean of some script is done at the client machine as opposed to the Server machine. JavaScript is an example of a scripting language which is being understood by most web browsers just as any other HTML element.

Event Handlers Form elements are made to interact with scripts (small programs within the page for processing data). This interactions are done by means of Event Handlers. Event Handlers are attributes of form elements which their values determine what sort of actions to take in case an event occurred.

Examples of Events Submitting a form Clicking a mouse Passing a mouse over a link Loading a page Selecting an item or a button. Clicking a button, link,… Changing the value of a text field or text area …

Event Handlers for Text Field Number 1: <INPUT TYPE=“text” NAME=“num1” VALUE = “0” ONCHANGE=“do this action”> The value of the event handler attribute can be a piece of java script for running some process (for example processing the data in the text field) in response to a change to value of the text field. ONSELECT is another possible event handler attribute for text field.

CheckBox User chooses a sub-set of a number of options using a checkbox. Example: bike: car: airplane:

Radio Button Radio Button is for the case when we want the user to choose exactly one of the options. Example: Under Graduate graduate Note that if you want to make sure that only one of radio buttons can be selected you need to relate the radio buttons by having the same name for all of them.

Event Handler for Checkbox/Radio Button ONCLICK : when a radio button/check box has been clicked. Example: bike: <input type="checkbox" name="vehicle” value="Bike“ onclick = “do action related to clicking the bike”> car: <input type="checkbox" name="vehicle" value="Car“ onclick = “do action related to clicking the car” > airplane: <input type="checkbox" name="vehicle" value="Airplane“ onclick = “do action related to clicking the airplane”>

Do it yourself Add a set of checkboxes and a set of radio buttons to your html file. Checkbox with three options: Business, Computers and Travel. Radio buttons with choices: Male and Female. For now forget about even handler attributes.

Dropdown Menu Option1 Option2 Option3 Option4

Example Volvo Saab Fiat Audi

Do it yourself Add a dropdown menu to your html file. Feel free to choose any name for the menu and name and value for your options. For now forget about event handler attribute.

Text Area A user can write un-limited text in the text- area. – rows: The number of rows for the text area. – cols: The number of columns for the text area. ONSELECT and ONCHANGE are two possible event handler attributes for a text area. Add a textarea to your html.

Buttons A general button: ONCLICK is an event handler for button. A submit button will send the data collected by the form for processing. ONSUBMIT is an event handler for submit button. A reset button resets the form.

Do it yourself Add a general, a submit and a reset buttons to your html without having any event handler attributes for these buttons.

Values of Event Handlers in Java Script Remember: <INPUT TYPE=“button” NAME=“order” ONCLICK=“Do some action”> We can define some action using JavaScript.

Values of Event Handlers in Java Script Remember: <INPUT TYPE=“button” NAME=“order” ONCLICK=“Do some action”> We can define some action using JavaScript. One common way to this is to call a function or routine written in JavaScript.

Functions Remember from your math courses in high school or collage we had functions like this: f(x,y) = x + y then f(3,7) = = 10

Functions Remember from your math courses in high school or collage we had functions like this: f(x,y) = x + y then f(3,7) = = 10 In Computer Science a function is a similar concept. A function is a named sequence of instructions bundled together to perform a task. A function can have some parameters.

Functions Remember from your math courses in high school or collage we had functions like this: f(x,y) = x + y then f(3,7) = = 10 In Computer Science a function is a similar concept. A function is a named sequence of instructions bundled together to perform a task. A function can have some parameters. For example we have: add(x,y) : A sequence of instructions named “add” to add parameters x and y and return the result.

Functions in JavaScript We have two types of functions 1.Predefined functions: Those functions defined by JavaScript. We can use them without defining them. 2.Customized functions: Functions that we need to define first according to our need, then use it. That is there is no predefined function for handling the task we have in mind.

Example of Predefined Functions alert(message) Calling this function causes a message box to appear on the screen with message provided within open and close parenthesis. Example: alert(‘wrong password’)

Calling a Function We ask a function to perform the task it is designed for (calling a function) in this way: function_name(param1, param2,…); function_name : Name of the function param1 : the value we assign to first parameter of the function. param2: the value we assign to second parameter of the function. Example: alert(‘wrong password’);

Defining our own functions Syntax function name(param1,param2,…) { instruction1; instruction2; …. } Note that we define a JavaScript function inside and tags in our html file within and tags.

Example function order( item, price ) { instruction1; instruction2; …. }

Back to Event Handlers We can call a JavaScript function as an action corresponding to an event in form using event handler attributes. Example: <INPUT TYPE=“button” NAME=“order” ONCLICK=“order()”> Assuming we have defined function order() somewhere.

Another Example <select name="cars“ onchange = “alert(‘changed your car’)” > Volvo Saab Fiat Audi

Do it yourself Write a HTML form with a select and a button Form elements. When the button clicked you should receive a message box with message, “button has clicked” and when you change the menu item a message box with message “changed your selection” should appear on screen.