1 XHTML Forms A form is the mechanism to –Collect information from a browser user –Transmit collected information from a browser to a server HTML/XHTML.

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

Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Tutorial 6 Working with Web Forms
1 Introduction to XHTML: Part 2 Outline Introduction Basic XHTML Tables Intermediate XHTML Tables and Formatting Basic XHTML Forms More Complex XHTML Forms.
 2001 Deitel & Associates, Inc. All rights reserved. 1 Chapter 10 – Intermediate HTML 4 Outline 10.1Introduction 10.2Unordered Lists 10.3Nested and Ordered.
 2003 Prentice Hall, Inc. All rights reserved. Chapter 5 - Introduction to XHTML: Part 2 Outline 5.1 Introduction 5.2 Basic XHTML Tables 5.3 Intermediate.
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Table, Forms, Metatags and Frames.
XHTML Forms for Data Collection and Submission Chapter 5.
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?
CSE 382/ETE 334 Internet and Web Technology Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
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.
1 Outline 3.1 Introduction 3.2 Editing HTML 3.3 First HTML Example 3.4 W3C HTML Validation Service 3.5 Headers 3.6 Linking 3.7 Images 3.8 Special Characters.
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.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML Pt. 2.
 2002 Prentice Hall, Inc. All rights reserved.2 Chapter 2 — Introduction to HyperText Markup Language 4: Part I Outline 2.1Introduction 2.2Markup Languages.
1 HTML Advanced Features Dr. Awad Khalil Computer Science Department AUC.
 2004 Prentice Hall, Inc. All rights reserved. Chapter 5 - Introduction to XHTML: Part 2 Outline 5.1 Introduction 5.2 Basic XHTML Tables 5.3 Intermediate.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
1 Introduction to HTML: Part 1 Outline Introduction Elements and Attributes Editing HTML Common Elements Headers Images Unordered Lists Nested and Ordered.
1 Web Development Lecture # 11 Introduction to XHTML (Chapter # 4) It.GulGasht.Com.
Chapter 10 – Intermediate HTML 4 Outline 10.1Introduction 10.2Unordered Lists 10.3Nested and Ordered Lists 10.4Basic HTML Tables 10.5Intermediate HTML.
 2008 Pearson Education, Inc. All rights reserved Introduction to XHTML.
2.2 XHTML (cont.). Motto Yea, from the table of my memory I’ll wipe away all trivial fond records. —William Shakespeare.
HTML Forms.
LOGO FORMs in HTML CHAPTER 5 Eastern Mediterranean University School of Computing and Technology Department of Information Technology ITEC229 Client-Side.
1 Introduction to XHTML. 2 Main.html Program Output 1 2
 2001 Prentice Hall, Inc. All rights reserved. 1 Chapter 5 - Introduction to XHTML: Part 2 Outline 5.1 Introduction 5.2 Basic XHTML Tables 5.3 Intermediate.
XHTML 1.1  Derived from Standard Generalized Markup Language (SGML) of ISO  XHTML concerned primary with content rather than presentation and style 
Presentation 5: Advanced XHTML Tables, Forms, Image Maps, Meta data and Frames Fundamentals of Web-Centric Development.
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.
HTML Forms A Preliminary Step into Dynamic Web Fred Durao
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.
1 Introduction to XHTML: Part 1 Outline Introduction Elements and Attributes Editing XHTML Common Elements W3C XHTML Validation Service Headers Linking.
CP102 Module 7: HTML 1 Module 7: HTML 1.What is 1.What is HTML? 2. 2.Basic syntax, document structure 3. 3.Basic formatting, images, links 4. 4.Lists,
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.
TJ 3043 – Web Application Development HTML Form. 2.0 Forms - A form is the usual way information is gotten from a browser to a server - HTML has tags.
Lecture 6 More Advanced HTML Boriana Koleva Room: C54
HTLM Forms CS3505. Form Handling in Browser html User Files out form WEbBROWSErWEbBROWSEr User read response submit Get URL?input html Get file html script.
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.
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.
Netprog CGI and Forms1 CGI and Forms A detailed look at HTML forms.
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.
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.
1 HTML Forms
Creating Forms on a Web Page. 2 Introduction  Forms allow Web developers to collect visitor feedback  Forms create an environment that invites people.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
1 HTML forms (cont.)
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
 2003 Prentice Hall, Inc. All rights reserved. Outline Chapter 2 HTML (Hypertext Markup Language) Part II.
1 Chapter 2 - Introduction to HTML: Part 2 Outline Basic HTML Tables Intermediate HTML Tables and FormattingBasic HTML Forms More Complex HTML Forms Internal.
INTERNET APPLICATIONS CPIT405 Forms, Internal links, meta tags, search engine friendly websites.
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.
Client-Side Internet and Web Programming
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
Chapter 5 - Introduction to XHTML: Part 2
1 Introduction to XHTML.
Introduction to HTML: Forms
Presentation transcript:

1 XHTML Forms A form is the mechanism to –Collect information from a browser user –Transmit collected information from a browser to a server HTML/XHTML provides tags to create a collection of objects that implement the information collection and transmission The objects are called widgets (e.g., radio buttons and checkboxes) When the Submit button of a form is clicked, the form’s values are sent to the server

2 XHTML Forms All of the widgets, or components of a form are defined in the content of a tag Form elements and layout tags The only required attribute of is action –specifying the URL of the server program to be called when the Submit button is clicked action = " If the form has no action, the value of action is the empty string

3 Method attribute The method attribute of specifies the technique of transferring form data from the browser to the server: –get –post

4 Widgets Data is collected from users via widgets created with the tag The type attribute of specifies the kind of widget being created –Text boxes –Submit & reset buttons –Check boxes –Radio buttons –Drop-down lists

5 element type attribute –"text" text box –"password" like text box, but with *'s –"submit" submit button –"reset" reset button –"checkbox" check box –"radio" radio button –"hidden" not shown on form

6 element name attribute: identifies element in script –Group radio buttons or check boxes by using same name value attribute –Specifies text in a button –Specifies initial string in a text box –Distinguishes between radio buttons or checkboxes in a group

7 Creates a horizontal box for text input –Default size =20; changeable with the size attribute If more characters are entered than size, the box is scrolled (shifted) left To prevent user from typing in more characters than desired, set maxlength, which ignores excess input

8 XHTML Forms First Name: Last Name: Address #1: Address #2:

9 XHTML Forms First Name: Last Name: Address #1: Address #2: See example text.html

10 Text areas Text areas - created with Attributes –Name –to specify the size of text area rows height cols width Initial text goes between tags put default text here Scrolling is implicit if the area is overfilled Example: textarea.html

11 … Groups a form element with description Typical stuff between tags: –Descriptive text –Input or textarea element

12 Checkboxes Purpose: to collect multiple choice input Rules: –All checkboxes in a group should have the same name attribute –Each checkbox requires a value attribute to supply the value when the checkbox is ‘checked’ –Au unchecked checkbox contributes no value to the form data –Default, no checkbox is initially ‘checked’ –To initialize a checkbox to ‘checked’, set the checked attribute to "checked" See example checkbox.html

13 Radio Buttons Purpose: Only one button in a collections of radio buttons can be ‘checked’ Rules: –Every button in a radio button group MUST have the same name –If no button in a radio button group is ‘pressed’, the browser often ‘presses’ the first one See example radiobutton.html

14 Menus Created with tags Usage: 2 types of menus –Similar to checkboxes –Similar to radio buttons (the default) Menus similar to checkboxes –set multiple attribute to "multiple" name attribute of is required Set size attribute of to specify the number of menu items to be displayed (the default is 1) If size is set to > 1 or if multiple = “multiple” the menu is displayed as a drop-down menu See examples menu.html, menu3.html, DropDownMenu.html

15 Drop-down Lists … …

16 Drop-down Lists … attribute selected = "selected" marks default selection

17 Reset and Submit buttons Both widgets created with – Submit has two actions: 1.Encode the data of the form 2. Request that the server execute the server-resident program specified as the value of the action attribute of A submit button is required in every form See example epurchase.html

18 Exercise: design a student form Text box: Name Password box: ID number Radio buttons: freshman, sophomore, junior, senior Check boxes:hobbies Drop-down list: Major Text area: favorite quote Submit button, reset button

 2001 Prentice Hall, Inc. All rights reserved. Outline 19 Form.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " Internet and WWW How to Program - Forms Feedback Form Please fill out this form to help 18 us improve our site <input type = "hidden" name = "recipient" 28 value = /> 29 <input type = "hidden" name = "subject" 30 value = "Feedback Form" /> 31 <input type = "hidden" name = "redirect" 32 value = "main.html" /> 33 Each form must begin and end with form tags. The method attribute specifies how the form’s data is sent to the Web server. The post method appends form data to the browser request. The value of the action attribute specifies the URL of a script on the Web server. Input elements are used to send data to the script that processes the form. A hidden value for the type attribute sends data that is not entered by the user.

 2001 Prentice Hall, Inc. All rights reserved. Outline 20 Form.html inserts a text box --> 36 Name: 37 <input name = "name" type = "text" size = "25" 38 maxlength = "30" /> <input type = "submit" value = 46 "Submit Your Entries" /> 47 <input type = "reset" value = 48 "Clear Your Entries" /> The size attribute gives the number of characters visible in the text box. The maxlength attribute gives the maximum number of characters the user can input. The label element describes the data the user needs to enter in the text box. The value attribute displays a name on the buttons created.

 2001 Prentice Hall, Inc. All rights reserved. Outline 21 Program Output Text box created using input element. Submit button created using input element. Reset button created using input element.

 2001 Prentice Hall, Inc. All rights reserved. Outline 22 Form2.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " Internet and WWW How to Program - Forms Feedback Form Please fill out this form to help 18 us improve our site <input type = "hidden" name = "recipient" 24 value = /> 25 <input type = "hidden" name = "subject" 26 value = "Feedback Form" /> 27 <input type = "hidden" name = "redirect" 28 value = "main.html" /> Name:

 2001 Prentice Hall, Inc. All rights reserved. Outline 23 Form2.html 35 creates a multiline textbox --> 36 Comments: Enter your comments here inserts a --> Address: 46 <input name = " " type = "password" 47 size = "25" /> Things you liked: Site design 54 <input name = "thingsliked" type = "checkbox" 55 value = "Design" /> Links 58 <input name = "thingsliked" type = "checkbox" 59 value = "Links" /> Ease of use 62 <input name = "thingsliked" type = "checkbox" 63 value = "Ease" /> Images 66 <input name = "thingsliked" type = "checkbox" 67 value = "Images" /> 68 Setting an input element’s type attribute to checkbox will create a checkbox. Checkboxes that belong to the same group must have same value in the name attribute. The textarea element renders a text area when the page is displayed. The size of the text area can be specified with the rows and cols attribute.

 2001 Prentice Hall, Inc. All rights reserved. Outline 24 Form2.html Program Output 69 Source code 70 <input name = "thingsliked" type = "checkbox" 71 value = "Code" /> Checkbox options created with input element. Text area created with input element.

 2001 Prentice Hall, Inc. All rights reserved. Outline 25 Form3.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " Internet and WWW How to Program - Forms Feedback Form Please fill out this form to help 18 us improve our site <input type = "hidden" name = "recipient" 24 value = /> 25 <input type = "hidden" name = "subject" 26 value = "Feedback Form" /> 27 <input type = "hidden" name = "redirect" 28 value = "main.html" /> Name:

 2001 Prentice Hall, Inc. All rights reserved. Outline 26 Form3.html 35 Comments: 36 <textarea name = "comments" rows = "4" 37 cols = "36"> Address: 41 <input name = " " type = "password" 42 size = "25" /> Things you liked: Site design 48 <input name = "things" type = "checkbox" 49 value = "Design" /> Links 52 <input name = "things" type = "checkbox" 53 value = "Links" /> Ease of use 56 <input name = "things" type = "checkbox" 57 value = "Ease" /> Images 60 <input name = "things" type = "checkbox" 61 value = "Images" /> Source code 64 <input name = "things" type = "checkbox" 65 value = "Code" /> 66 67

 2001 Prentice Hall, Inc. All rights reserved. Outline 27 Form3.html 68 creates a radio --> How did you get to our site?: Search engine 76 <input name = "how get to site" type = "radio" 77 value = "search engine" checked = "checked" /> Links from another site 81 <input name = "how get to site" type = "radio" 82 value = "link" /> Deitel.com Web site 85 <input name = "how get to site" type = "radio" 86 value = "deitel.com" /> Reference in a book 89 <input name = "how get to site" type = "radio" 90 value = "book" /> Other 93 <input name = "how get to site" type = "radio" 94 value = "other" /> The checked attribute will mark this radio option by default. An input element with type value equal to radio creates radio buttons.

 2001 Prentice Hall, Inc. All rights reserved. Outline 28 Form3.html Rate our site: tag presents a drop-down --> tags --> Amazing Awful <input type = "submit" value = 124 "Submit Your Entries" /> The selected attribute selects a default value for the drop down list. The select element creates a drop down list. The option tag is used for each option in the drop down list.

 2001 Prentice Hall, Inc. All rights reserved. Outline 29 Program Output Drop down box list created with input element.The Amazing option is selected as a default value. Radio box list created with input element.

 2001 Prentice Hall, Inc. All rights reserved. Outline 30 Program Output

 2001 Prentice Hall, Inc. All rights reserved. Outline 31 Links.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " Internet and WWW How to Program - List creates an internal hyperlink --> The Best Features of the Internet Go to Favorite CEOs You can meet people from countries 24 around the world You have access to new media as it becomes public: New games 29 New applications For Business 32 For Pleasure To internally link, place a # sign in front of the name of the desired anchor element within the page.

 2001 Prentice Hall, Inc. All rights reserved. Outline 32 Links.html 36 Around the clock news 37 Search Engines 38 Shopping 39 Programming XHTML 42 Java 43 Dynamic HTML 44 Scripts 45 New languages Links 52 Keeping in touch with old friends 53 It is the technology of the future! My 3 Favorite CEOs Go to Favorite Features An anchor named ceos will be created at this point on the page. This anchor does not link and will not be seen on the page. However, other anchors can refer to this anchor and link to it.

 2001 Prentice Hall, Inc. All rights reserved. Outline 33 Links.html Program Output Bill Gates 68 Steve Jobs 69 Michael Dell Clicking on this internal link will bring the user to the bottom of the page where My 3 Favorite CEOs is located.

 2001 Prentice Hall, Inc. All rights reserved. Outline 34 Picture.html 1 2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" 3 " Internet and WWW How to Program - Image Map tag defines an image map --> <area href = "form.html" shape = "rect" 26 coords = "2,123,54,143" 27 alt = "Go to the feedback form" /> 28 <area href = "contact.html" shape = "rect" 29 coords = "126,122,198,143" 30 alt = "Go to the contact page" /> 31 <area href = "main.html" shape = "rect" 32 coords = "3,7,61,25" alt = "Go to the homepage" /> 33 <area href = "links.html" shape = "rect" 34 coords = "168,5,197,25" 35 alt = "Go to the links page" /> The area element is used to create hotspots. The shape attribute defines a shape for the hotspot. The first two integers of the coordinate attribute define the (x,y) coordinate of the upper-left hand corner of the rectangle. The last two integers define the (x,y) coordinate of the lower-right hand corner of the rectangle.

 2001 Prentice Hall, Inc. All rights reserved. Outline 35 Picture.html <area shape = "poly" alt = " the Deitels" 40 coords = "162,25,154,39,158,54,169,51,183,39,161,26" 41 href = /> <area href = 46 shape = "circle" coords = "100,36,33" 47 alt = " the Deitels" /> indicates that the --> <img src = "deitel.gif" width = "200" height = "144" 53 alt = "Deitel logo" usemap = "#picture" /> Assigning poly to the shape attribute creates a polygon with coordinates defined by the coords attribute. Assigning circle to the shape attribute creates a circle, with a center and radius specified by the coords attribute. The image map assigned to the usemap attribute will be used with the image. The # in front of the name of the image map indicates that an internal image map is being used.

 2001 Prentice Hall, Inc. All rights reserved. Outline 36 Program Output Hotspots created using the area element. Selecting the Feedback hotspot links to the page below.