CSCI N241: Fundamentals of Web Design Copyright ©2006  Department of Computer & Information Science Creating Web Forms.

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

Tutorial 6 Creating a Web Form
SE-2840 Dr. Mark L. Hornick 1 HTML input elements and forms.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Intermediate Level Course. Text Format The text styles, bold, italics, underlining, superscript and subscript, can be easily added to selected text. Text.
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
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.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Table, Forms, Metatags and Frames.
Creating Web Page Forms
XHTML Forms for Data Collection and Submission Chapter 5.
ECA 228 Internet/Intranet Design I Forms. ECA 228 Internet/Intranet Design I Forms forms are a way for a user to communicate with you – text fields –
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
1 ADVANCED MICROSOFT WORD Lesson 15 – Creating Forms and Working with Web Documents Microsoft Office 2003: Advanced.
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.
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.
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?
Lesson 13: Building Web Forms Introduction to Adobe Dreamweaver CS6 Adobe Certified Associate: Web Communication using Adobe Dreamweaver CS6.
CSE 382/ETE 334 Internet and Web Technology Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
DAT602 Database Application Development Lecture 14 HTML.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
HTML II. Factors to consider in designing a website. Organizing your files. HTML Tables. Unordered Lists. Ordered Lists. HTML Forms. Learning Objectives.
Creating a Web Site to Gather Data and Conduct Research.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
Chapter 8 Collecting Data with Forms. Chapter 8 Lessons Introduction 1.Plan and create a form 2.Edit and format a form 3.Work with form objects 4.Test.
 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.
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.
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.
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.
1 HTML Forms
CSCI N241: Fundamentals of Web Design Copyright ©2006  Department of Computer & Information Science Understanding the Cascade in CSS.
Web Forms. Survey or poll Contact us Sign up for an newsletter Register for an event Submit comments or feedback about our site Log in to a members-only.
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.
Copyright © Texas Education Agency, All rights reserved.1 Web Technologies Website Forms / Data Acquisition.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Creating Web Page Forms COE 201- Computer Proficiency.
HTML Forms.
HTML FORMS Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1.
Chapter 9 Quick Links Slide 2 Performance Objectives Understanding Forms Planning Forms Creating Forms Creating Text Fields Creating Hidden Fields Creating.
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
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.
Tutorial 6 Creating a Web Form
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.
TNPW1 Ing. Jiří Štěpánek.  ordered list  (list item)  unordered list  (list item)
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.
CSCI N241: Fundamentals of Web Design Copyright ©2006  Department of Computer & Information Science Using CSS for Absolute Layouts.
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Tutorial 6 Working with Web Forms
Creating and Processing Web Forms
Objectives Design a form Create a form Create text fields
Basic XHTML Tables XHTML tables—a frequently used feature that organizes data into rows and columns. Tables are defined with the table element. Table.
Chapter 5 Introduction to XHTML: Part 2
Introducing Forms.
The Internet 10/27/11 XHTML Forms
Presentation transcript:

CSCI N241: Fundamentals of Web Design Copyright ©2006  Department of Computer & Information Science Creating Web Forms

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Goals By the end of this unit, you should understand … … how forms communicate with servers.… how forms communicate with servers. … how to build forms using several form fields.… how to build forms using several form fields. … the differences between POST and GET form methods.… the differences between POST and GET form methods. … how to add style to a form.… how to add style to a form.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Introducing Forms Until now, our development focused on static web pages which enabled only one-way communication.Until now, our development focused on static web pages which enabled only one-way communication. Web forms expand our toolkit to enable two-way communication between the server (and, thus, the owner of a web site) and the web user.Web forms expand our toolkit to enable two-way communication between the server (and, thus, the owner of a web site) and the web user.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science How Forms Work Web Application A A – The user completes a form and clicks the SUBMIT button. This action packages the form data and sends it to the server B – A web application (built using PHP, Perl, C or some other language) processes the form data. B C – The server sends an XHTML page to the browser as a response, which the browser displays to the user. C

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Common Form Components The ElementThe Element TextboxesTextboxes Text AreasText Areas Radio ButtonsRadio Buttons CheckboxesCheckboxes Drop Down MenusDrop Down Menus Multiple Select MenusMultiple Select Menus Password FieldsPassword Fields Hidden FieldsHidden Fields Fieldset & LegendsFieldset & Legends LabelsLabels Submit ButtonSubmit Button Reset ButtonReset Button ButtonsButtons

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science The Element We nest all other form elements inside the element. It has the following attributes:We nest all other form elements inside the element. It has the following attributes: –The id attribute identifies the form as a unique entity. –The action attribute points the browser to a web application for processing the form. –The method attribute tells the browser how to send the form data ( GET or POST ).

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science The Textbox We use the textbox for small amounts of information, like a name, address, etc.We use the textbox for small amounts of information, like a name, address, etc. To build a textbox, we use the element using the following attributes:To build a textbox, we use the element using the following attributes: –We set the type attribute to text. –We give each textbox a unique identity using the name attribute.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science The Submit Button A submit button tells the browser to give a web application the form data for processing.A submit button tells the browser to give a web application the form data for processing. The browser sends the data as a package to the web application indicated by the element's action attribute.The browser sends the data as a package to the web application indicated by the element's action attribute.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science The Submit Button (cont.) To create a submit button, we use the element with the following attributes:To create a submit button, we use the element with the following attributes: –We set the value of the type attribute to submit. –We also can add a value attribute to configure our button's text.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science The Reset Button We can also add a reset button to give our user's a convenient way to clear the form's fields quickly. To create a reset, we use the element with the following attributes:We can also add a reset button to give our user's a convenient way to clear the form's fields quickly. To create a reset, we use the element with the following attributes: –We set the value of the type attribute to reset. –We also can add a value attribute to configure our button's text.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Download & extract the file n241CreatingForms_Examples.zip.Download & extract the file n241CreatingForms_Examples.zip. Open the file form.html in your editor.Open the file form.html in your editor. Add the code you see on the next slide to the element.Add the code you see on the next slide to the element.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Add this code … Ship to: Name: Address: City: State: Zip:

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science GET vs. POST The form has two options to tell the browser how to send form data to the server (using the method attribute) – GET or POST.The form has two options to tell the browser how to send form data to the server (using the method attribute) – GET or POST. The GET value submits form data as part of a URL. We use the GET value when user's might want to bookmark the page that is the result of a web form.The GET value submits form data as part of a URL. We use the GET value when user's might want to bookmark the page that is the result of a web form.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science GET vs. POST The POST value doesn't display form data in the URL; we use POST for processing orders or forms with other sensitive material.The POST value doesn't display form data in the URL; we use POST for processing orders or forms with other sensitive material. Finally, we use POST for forms that include a element, since GET requests limit input data to 256 characters.Finally, we use POST for forms that include a element, since GET requests limit input data to 256 characters. We can specify GET or POST using the element's method attribute.We can specify GET or POST using the element's method attribute.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Update the element's method attribute to GET.Update the element's method attribute to GET. What happened when you submit the form?What happened when you submit the form? Change the value back to POST.Change the value back to POST.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Creating a Drop Down List We can create a drop down list using the select and option elements. The select element creates a menu and the option elements create menu choices.We can create a drop down list using the select and option elements. The select element creates a menu and the option elements create menu choices. We use the name attribute to give the select element a unique identifier. … We use the name attribute to give the select element a unique identifier. …

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Creating Menu Values We can create menu values using the element.We can create menu values using the element. It uses the value attribute to identify the data that the form will send to the server on its behalf: Navy Blue It uses the value attribute to identify the data that the form will send to the server on its behalf: Navy Blue

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Build a drop down menu at the top of your form, above the Ship To: paragraph: Choose your beans: HouseBlend Shade Grown Bolivan Supremo Organic Guatemalan Kenya Build a drop down menu at the top of your form, above the Ship To: paragraph: Choose your beans: HouseBlend Shade Grown Bolivan Supremo Organic Guatemalan Kenya

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Creating Radio Buttons We use radio buttons when we want the user to select a single option from among a group of options.We use radio buttons when we want the user to select a single option from among a group of options. Attributes:Attributes: –Set type equal to radio –Assign the same value for the name attribute for each member in the group. –Differentiate the radio buttons in the same group using the value attribute. –For one of the members in the radio button group, we can set the checked attribute to checked, which selects that value, by default, when the page loads.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Build a group of radio buttons below the drop down menu on your form & above the Ship To: paragraph: Type: Whole Bean Ground Build a group of radio buttons below the drop down menu on your form & above the Ship To: paragraph: Type: Whole Bean Ground

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Labels Instead of using plain text to describe form fields (like our radio buttons), we can use the label element.Instead of using plain text to describe form fields (like our radio buttons), we can use the label element. The label element makes your form more accessible to adaptive software and improves the structure of your page.The label element makes your form more accessible to adaptive software and improves the structure of your page.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Labels To use the label element, we need to first make sure that the form field for which we want to use a label has an id attribute: To use the label element, we need to first make sure that the form field for which we want to use a label has an id attribute: Next, we use the for attribute of the label to make the connection between the two: Ground Next, we use the for attribute of the label to make the connection between the two: Ground

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Update your radio buttons to use labels: Type: Whole Bean Ground Update your radio buttons to use labels: Type: Whole Bean Ground

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Grouping Fields Visually We can group fields visually together using the and elements.We can group fields visually together using the and elements. The defines a border around a group of related form fields.The defines a border around a group of related form fields. The element, which we define nested inside, gives that group a label.The element, which we define nested inside, gives that group a label.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Group your radio buttons using the : Type Group your radio buttons using the : Type

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Checkboxes Like radio buttons, checkboxes in a group share the same name, but have different values.Like radio buttons, checkboxes in a group share the same name, but have different values. However, unlike radio buttons, users can select more than one checkbox in a group.However, unlike radio buttons, users can select more than one checkbox in a group.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Checkbox Attributes Use the element with the type configured to checkbox.Use the element with the type configured to checkbox. Give the name attribute the same name for each member in a group.Give the name attribute the same name for each member in a group. Give unique names to the value attribute of each checkbox.Give unique names to the value attribute of each checkbox. If you want a checkbox to appear checked when the form loads, configure the checked attribute with a value of checked.If you want a checkbox to appear checked when the form loads, configure the checked attribute with a value of checked.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Copy the following code in a above the Ship To paragraph: Extras Gift Wrap Include a catalog with order Copy the following code in a above the Ship To paragraph: Extras Gift Wrap Include a catalog with order

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Comment Fields When we want to give the user a large area in which to add comments, we can use the element.When we want to give the user a large area in which to add comments, we can use the element. The element includes the following attributes:The element includes the following attributes: –We use the name attribute to uniquely identify the element. –We use the rows attribute to specify the number of visible rows of text. –We use the cols attribute to specify the width of the.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Let's Try One! Add the following just above the form's buttons: Customer Comments: Add the following just above the form's buttons: Customer Comments:

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Adding Style to Forms Although normally considered a bad idea for page layout, most developers use a borderless table for form layout.Although normally considered a bad idea for page layout, most developers use a borderless table for form layout. Why? Using CSS to position individual form fields is a tremendous task. Additionally, we can consider forms to be tabular data (okay, so that might be a stretch … ).Why? Using CSS to position individual form fields is a tremendous task. Additionally, we can consider forms to be tabular data (okay, so that might be a stretch … ).

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Form Style Examples Open the file styledform.html.Open the file styledform.html. Open the file css/styledform.css.Open the file css/styledform.css. After viewing the HTML in your browser, open both files in an editor.After viewing the HTML in your browser, open both files in an editor.

N241: Fundamentals of Web Development Copyright ©2006  Department of Computer & Information Science Questions?

References Freeman, Elisabeth and Eric Freeman. Head First HTML with CSS & XHTML. Sebastopol, CA: 2006.Freeman, Elisabeth and Eric Freeman. Head First HTML with CSS & XHTML. Sebastopol, CA: Neiderst-Robbins, Jennifer. Web Design in a Nutshell, Third Edition. Sebastopol, CA: 2006.Neiderst-Robbins, Jennifer. Web Design in a Nutshell, Third Edition. Sebastopol, CA: 2006.