INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.

Slides:



Advertisements
Similar presentations
HTML Forms. collect information for passing to server- side processes built up from standard widgets –text-input, radio buttons, check boxes, option lists,
Advertisements

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.
Tutorial 6 Creating a Web Form
Lecture 14 HTML Forms CPE 401 / 601 Computer Network Systems slides are modified from Dave Hollinger.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
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.
Tutorial 6 Working with Web Forms
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.
USER INTERACTIONS: FORMS
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Creating Web Page Forms
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
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.
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.
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.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
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.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
 Whether using paper forms or forms on the web, forms are used for gathering information. User enter information into designated areas, or fields. Forms.
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.
ITCS373: Internet Technology Lecture 5: More HTML.
XHTML & Forms. PHP and the WWW PHP and HTML forms – Forms are the main way users can interact with your PHP scrip Typical usage of the form tag in HTML.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
TJ 3043 – Web Application Development HTML Form. 2.0 Forms A form is the usual way to communicate information from a Web browser to a server HTML has.
Creating Web Page Forms. Introducing Web Forms Web forms collect information from users Web forms include different control elements including: –Input.
1 HTML Forms
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.
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.
Forms Collecting Data CSS Class 5. Forms Create a form Add text box Add labels Add check boxes and radio buttons Build a drop-down list Group drop-down.
Web Page Design Forms! Website Design. Objectives What forms can do The Attributes of the form tag Using Textboxes Textareas Checkboxes Radio buttons.
+ 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.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
HTML Forms.
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.
1 HTML Forms
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
1 HTML forms (cont.)
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
Tutorial 6 Creating a Web Form
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.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
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.
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.
How to Write Web Forms By Mimi Opkins.
Objectives Design a form Create a form Create text fields
ITE 115 Creating Web Page Forms
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Introducing Forms.
Forms, cont’d.
CNIT 131 HTML5 - Forms.
Presentation transcript:

INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE

2 Outline Form - Next class: – Client-side validation

33 Introduction to Forms Example: form_ex_1.html

4 Introduction to Forms HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, textarea, checkboxes, radio-buttons, submit buttons, select lists, fieldset, legend, and label elements. The client fill-out some information and then the browser sends the data from the form fields to the server for processing, to an address, or to a JavaScript subroutine.

5 Introduction to Forms Syntax: A document may have more than one form, but forms cannot be nested.

method: specifies how the data will be transmitted. The method is the short way of saying HTTP request method. It tells the server the request is being made of what kind of request it is. - method=“get”: the default method. The fill-out form contents to be appended to the URL as if they were a normal query (maximum of 256 characters). - method=“post” : the fill-out form contents to be sent to the server in a data body rather than as part of the URL Method “post” is more secure. 6 Attributes for

7 The action attribute tells browser where to post the form data or which address to get with the appended data. This is the action that takes place when the user presses the submit button.

8 tag The tag is used to specify a simple input element inside a form that can receive user input. All tags are required to have a type attribute. Except for the submit and reset buttons they must also have a name attribute. The type indicates what sort of input field the tag represents, such as text boxes or radio buttons. The name/id attribute creates a named data field, or variable, to assign values to. The name/id attribute must be unique within a form, although some types of input may take multiple tags to define

9 type Attribute type = “text”: single line text input field in which the user can enter text. type = “password”: a text field where the content is masked, such as password fields. type = “checkbox” : a toggle that the user can select (switch on) or deselect (switch off.) type= “radio”: one of a set of radio buttons, which is a collection of selectable check boxes where only one in the group can be chosen. type= “file”: allows the user to select of file on their computer for submission to the server. type = “hidden”: denotes a hidden field, usually for sending additional system generated information along with the form, for instance, the form version number.

10 type Attribute type= “reset”: reset all elements in the form to their default values. type= “submit”: when a user clicks a submit button, the form is submitted, which means that the action specified for the form is invoked. type=“image”: Places an image, serving as a custom button in place of the submit button. When a user clicks the image, the form is submitted to the server. New in HTML5: type =“ ”: a field for . type = “number”: a field for number, type = range: slider control for number range.

Attributes for checked: element is selected when page loads disabled: value cannot be submitted maxlength = “maximum amount of text” maxlength can be larger than the size, -- scroll. readonly size = width in number of characters value = “initial/ default value” multiple 11

Attributes for New in HTML5: autocomplete= “on” or ”off” (form_ex_3.html) autofocus: element automatically get focus when page loads max: max value for an element min: min value for an element placeholder= “hint for input” Required list: with to provide a list of predefined options 12

13 Text Fields in a Form

14 Text Fields in a Form A text field is an empty field that is one line high and of a given length that accepts a single line of input from a user.

: specifies a list of pre-defined options for an element. To provide an "autocomplete" feature on elements. Users will see a drop-down list of pre-defined options as they input data. (form_ex_3.html) 15 Department: IT Finance Sales

16 Text Fields in a Form what the user types does not display on the screen. Instead it is masked by some masking character, such as an asterisk. Note: the password type only secures the information from prying eyes, it does not secure it from prying programs. The data written into the field is still stored as a string of plain text and is still transmitted unencrypted unless a secure transmission method is used. Type in your password:

17 Text Fields in a Form Allows the user to select a file to be sent back to the server by browsing the directories. The file name is included as a text string which the browser uses to retrieve the document. In order to use this type of data field, you must set your method to post. Select a file:

18 : allows for multi-line input fields. attributes: - rows = “height of the textarea in character” i.e., the number of lines up - cols = “width of the textarea in character” i.e., the number of characters across. - name = “symbolic name of the text entry field“ Input your comments: Text Fields in a Form

19 Selection Fields in a Form Selection fields allow you to choose from a selection of options. These choices can be exclusive, in the case of radio buttons, meaning you can only select one, or can be non-exclusive, such as checkboxes, meaning you can choose many from a list. The selection field types are:

20 Selection Fields in a Form The checkbox input type creates an item that can be checked or unchecked. When sending data from checkboxes, only the data from selected checkboxes is sent. Blank, unselected checkboxes have no data sent. Attributes: value = “data” : data sent to server checked = “checked”: pre-selected Although the items appear to be in a list, each one is a separate data field that is returned separately when the data is submitted. Since the items are a list, you can choose to name each element separately, or you can name all the elements in the list with the same name.

21 Selection Fields in a Form similar to the function of the checkbox, except that only one option can be selected at a time. All fields in a radio button group should also have the same name, since they are all different possible values for the same variable The radio button list will always return only one value. Attributes: - value = “data” : data sent to server - checked = “checked”: pre-selected - only one radio button in a button grouping can be marked as checked.

tag Define a label element. It does not render as anything special for the user. It provides a usability improvement for mouse users, – if the user clicks on the text within the element, it toggles the control. The for attribute of the tag should be equal to the id attribute of the related element to bind them together. 22

Example Female Male 23 form_ex_2.html music sports reading

24 Selection Fields in a Form … create a drop down menu or scrollable list of selectable choices. Ex: (form_ex_2.html) the interested topics: web design programming database

Selection List The selection list itself is defined by a series of tags. The name to the tag applies to the entire list. If more than one option is selected in the list, the options are all sent to the server under that one variable name as a comma separated list. 25

26 Selection Fields in a Form … Attributes: - multiple="multiple“: allows users to select more than one option, usually by holding down the Control key while clicking on additional choices. Otherwise the selection functions like radio buttons where selecting one deselects another. - size = “ how many lines are display in the selection menu” ** If the size is not specified or if it is set to a value of one (size="1") then a single line is displayed and the selection menu functions as a drop down menu. ** If a number larger than one is specified, then the menu functions as a scrollable list.

27 Selection Fields in a Form … The … tag is what is used to define the individual selectable elements in the menu. one tag for each item. The contents between the tag is what shows up in the menu listing. The value attribute is the value that is returned by selecting that option. If a value is not specified, the contents of the option tag are returned.

28 Selection Fields in a Form … tag to group things by category. the details of the topics: XHTML Frames Forms C language Java form_selection.html

29 Form Buttons Buttons are selectable icons that perform some action when clicked on. They are sometimes called action buttons since some action occurs when one is clicked on. The different types of buttons are: -

30 Form Buttons Allow users to submit the data and to reset the form, respectively. “submit”: submit form to the server as per the method and action attributes of the form. “reset”: does not send anything back to the server. It clears and resets the form.

31 Form Buttons If you do not provide value attributes for these buttons then they have default names that are system dependent. If you provide a name attribute for the submit button, then you must also provide a value, since that value will be sent back associated with the name. There is no need to assign a name to reset button, although it can be assigned a value if you want a reset message other than the default.

32 Form Buttons - examples Submit buttons: Reset buttons: Example: form_ex_buttons.html

33 Form Buttons Use image as the submit button. The submission includes: - data of the form - x, y coordinates of the mouse click within the image. Example: form_ex_buttons.html

34 Form Buttons An action button that is neither a submit button nor a reset button. Does absolutely nothing, unless you tell it to. Needs to be associated with event attributes that determine what to do when the button is selected. <input type="button" value="Press This Button" onclick="window.alert('using type =button....')" /> Example: form_ex_buttons.html

35 Form Buttons The tag allows you to perform most of the above actions with greater flexibility. content showing as button type attributes: - Example: form_ex_buttons.html

36 Accessing Fields use the tabindex attribute to specify a tab order. The tab index starts at one (1) and increases with adding items. If tabindex=“0“ or tabindex="-1“ (negative number), then the field cannot be tabbed to, although it can still be selected with the mouse. Course: <input type = "text" name ="courseName" size = "30" maxlength="50" value = “BTI220“ tabindex = "1" /> Name: <input type="text" name="MyName" size="30" maxlength="50" tabindex ="20"/> Question: <input type="text" name="Quest" size="30" maxlength="100" tabindex = "10"/>

37 Grouping Fields : grouping the fields : specifying a title for the group Some Questions Course: <input type = "text" name ="courseName" size = "30" maxlength="50" value = “BTI220"/> Name: <input type="text" name="MyName" size="30" maxlength="50“/> Example: form_ex_advanced.html

38 Remarks about Forms HTML itself does not control what is entered in text fields or validate the data entered. Two possible solutions: (1) use clear and concise directions for the form (2) write client-side or server-side programs to test the data before sending it to the program that is supposed to process it.

39 Remarks about Forms Try to make the browser window user-friendly. Clear directions for all form elements. Make sure fields are neatly arranged and are sized to reflect the content that goes in them. Use selection buttons rather than text boxes whenever possible to reduce the number of possible answers the user can give or must choose from.

40 Nice structure and flow - Structure: grouping the form into coherent units. - Structure allows to break the form up into smaller units, - Flow: having the coherent units cohere into a narrative that the user can work their way through. - Flow ensures that people don't get lost moving through the form. - In other words, things should be grouped sensibly and in a sensible order. Remarks about Forms

Lab 5 Practice on forms 41

Next Class Client-side validation 42

Thank you!