Lesson 8 Week 8 Designing Forms

Slides:



Advertisements
Similar presentations
Video, audio, embed, iframe, HTML Form
Advertisements

Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
XP 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
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.
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.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
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?
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.
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.
ITCS373: Internet Technology Lecture 5: More 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.
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.
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.
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,
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.
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.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
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. 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.
Web Forms. Web Forms: A form allows our web visitors to submit information to us. Some examples uses for forms are to let the web user contact us, fill.
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.
Tutorial 6 Working with Web Forms
Advanced HTML Tags:.
CHAPTER 2 MARKUP LANGUAGE
Web Forms.
Client-Side Internet and Web Programming
Making your HTML Page Interactive
Web Forms.
How to Write Web Forms By Mimi Opkins.
Introduction to HTML Forms and Servlets
HTML Forms Pat Morin COMP 2405.
FORMS IN HTML.
>> More on HTML Forms
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.
Web Programming– UFCFB Lecture 10
ARUSHA TECHNICAL COLLEGE WEB DESIGN(html forms)
Designing Forms Lesson 10.
Creating Form Elements
Creating Form Elements
Web Development & Design Foundations with H T M L 5
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.
CNIT 131 HTML5 - Forms.
Principles of Web Design 5th Edition
Focus of the last lecture was on HTML Lists & Tables
Creating Forms on a Web Page
© Hugh McCabe 2000 Web Authoring Lecture 8
Introduction to HTML: Forms
Lesson 6: Web Forms.
Web Forms.
Making your HTML Page Interactive
Unit 5 Create Forms.
Presentation transcript:

Lesson 8 Week 8 Designing Forms Biblical Relationship The Creation of Heaven & Earth Gen. 1:31

Introduction Today’s lesson is about creating HTML forms to collect information from people visiting your Web site. Forms enable you to gather just about any kind of information for immediate processing by a server-side script or for later analysis using other applications.

Objectives At the end of this lesson, you should be able to carry out the followings:  • Discovering how HTML forms interact with server-side scripts to provide interactivity • Creating simple forms • Learning all the types of form controls you can use to create radio buttons, check boxes, and more • Using more advanced form controls to enhance your designs • Planning forms so that your data matches any server-side scripts you use  

Creating a simple form The following tag is a form created to accept names and password: <!DOCTYPE html PUBLIC “-//W3C//DTD XHTML 1.0 Transitional//EN” “http://www.w3.org/TR/xhtml1/DTD/transitional.dtd”> <html> <head> <title>Page Title</title> </head> <body> </body> </html> <form action=“http://www.example.com/cgi-bin/entrance.cgi” method=“post”> Username: <input type=“text” name=”Username” /> <br> Password: <input type=“password” name=“password” /> <input type=”submit” value=”Log In” /> </form>

Explanations The action attribute, which is required, specifies the URL to the server-side script (including the filename) that will process the form when it’s submitted. It’s very important that the script with the name you’ve entered is present on your Web server at the location the URL specifies. In this example, the full URL for the script was used, but you can just as easily use a relative URL if it makes more sense.

Explanations Cont’d The two most commonly used attributes of the <form> tag are action and method. Both of these attributes are optional. The following example shows how the <form> tag is typically used: <form action=”someaction” method=”get or post”>, this two possible values: post or get defines how form data is submitted to your Web server. The post method includes the form data in the body of the form and sends it to the Web server. The get method appends the data to the URL specified in the action attribute and most often is used in searches.

Explanations Cont’d If you leave out the action attribute, the form is submitted to the current URL. In other words, if the form appears on the page http://www.example.com/form.html and you leave off the action attribute, the form will be submitted to that URL by default. Although most forms send their data to scripts, you also can make the action link to another Web page or a mailto link. The latter is formed as follows: <form action=”mailto:somebody@isp.com” method=”post”> This attaches the form data set to an email, which then is sent to the email address listed in the action attribute.

Explanations Cont’d Notice that both form controls are created using the input element. The type attribute defines which type of control will be created. In this case, you have a text control and a password control. Each type of control has a distinct appearance, accepts a different type of user input, and is suitable for different purposes. Each control is also assigned a name that distinguishes it and its data from the other form controls. Finally, a submit button was added so that the user can send the information she entered into the form to the database.

Putting your form in a table format <form action="http://www.example.com/cgi-bin/entrance.cgi" method="post"> <table border="1"> <tr> <td align="right">Username:</td> <td><input type="text" name="username" /></td> </tr> <td align="right">Password:</td> <td><input type="password" name="password" /></td> </tr> <td align="center"> <input type="submit" value="Log In" style="margin-top: 20px”/> </td> <td><br /></td> </table> </form>

Creating Text Controls Text controls enable you to gather information from a user in small quantities. This control type creates a single-line text input field in which users can type information, such as their name or a search term. To create a text input field, create an input element and choose text as the value for the type attribute. <p>Enter your pet’s name: <input type=”text” name=”petname” /></p> You can modify the appearance of text controls by using the size attribute. Entering a number which enlarges the width of the text control in characters: <input type=”text” name=”petname” size=”15” />

Maximum length of characters To limit the number of characters a user can enter, add the maxlength attribute to the text control. Using default value <input type=”text” name=”petname” size=”15” maxlength=”15” value=”Enter Pet Name” /> In this case, Enter Pet Name appears in the field when the form is rendered in the Web browser. It remains there until the user modifies it.  Creating Password Controls The password and text field types are identical in every way except that the data entered in a password field is Indicated password. <input type=”password” name=”userpassword” size=”8” maxlength=”8” /></p>

Creating Submit & Reset Buttons Creating Submit Buttons Submit buttons are used to indicate that the user is finished filling out the form. <input type=”submit” value=”Send Form Data” /> Creating Reset Buttons Reset buttons set all the form controls to their default values. <input type=”reset” value=”Clear Form” />

<input type=”checkbox” name=”year” checked=”checked” /> Creating Check Box Controls Check boxes are fields that can be set to two states: on and off . To create a check box, set the input tag’s type attribute to checkbox. The name attribute is also required, as shown in the following example: <p>Check to receive SPAM email <input type=”checkbox” name=”spam” /></p>  To display the check box as checked, include the checked attribute, as follows: <input type=”checkbox” name=”year” checked=”checked” /> Practical work <p>Check all symptoms that you are experiencing:<br /> <input type=”checkbox” name=”symptoms” value=”nausea” /> Nausea <br/><input type=”checkbox” name=”symptoms” value=”lightheadedness” /> Light-headedness<br /> <input type=”checkbox” name=”symptoms” value=”fever” /> Fever<br /> <input type=”checkbox” name=”symptoms” value=”headache” /> Headache </p> 

Creating Radio Buttons Radio buttons, which generally appear in groups, are designed so that when one button in the group is selected, the other buttons in the group are automatically unselected. They enable you to provide users with a list of options from which only one option can be selected Practical work <p>Select a color:<br /> <input type=”radio” name=”color” value=”red” /> Red<br /> <input type=”radio” name=”color” value=”blue” /> Blue<br /> <input type=”radio” name=”color” value=”green” /> Green<br /> </p>

Hidden Form Fields Hidden form fields are used when you want to embed data in a page that shouldn’t be seen or modified by the user. <input type=”hidden” name=”id” value=”1402” />   Hidden form fields are generally used when data identifying the user needs to be included in a form. For example, let’s say you’ve created a form that allows a user to edit the name and address associated with her bank account. Because the user can change her name and address, the data she submits can’t be used to look up their account after she submits the form.

The File Upload Control The file control enables a user to upload a file when he submits the form. As you can see in the following code, the type for the input element is set to file: <p>Please select a file for upload: <input type=”file” name=”fileupload” /></p> If you want to use a file upload field on your form, you have to do a lot of behind-the- scenes work to get everything working. For one thing, the program specified in the action attribute of your form must be able to accept the file being uploaded. Second, you have to use the post method for the form. Third, you must set the enctype attribute of the <form> tag to multipart/form-data.  <form action=”/cgi-bin/upload.cgi” enctype=”multipart/form-data” method=”post”> <input type=”file” name=”new_file” /> <input type=”submit” /> </form> After you’ve created a form for uploading a file, you need a program that can process the file submission.  

Create Large Text-Entry Fields with textarea The textarea element creates a large text entry field where people can enter as much information as they like. To create a textarea, use the <textarea> tag. To set the size of the field, use the rows and cols attributes. These attributes specify the height and width of the text area in characters. A text area with cols set to 5 and rows set to 40 creates a field that’s 5 lines of text high and 40 characters wide.   <p>Please comment on our customer service.<br /> <textarea name=”question4” rows=”10” cols=”60”> Enter your answer here </textarea> </p>

Creating disabled and read only Controls Sometimes you might want to display a form control without enabling your visitors to use the control or enter new information. To disable a control, add the disabled attribute to the form control: <p>What is the meaning of life? <textarea name=”question42” disabled=”disabled”> Enter your answer here. </textarea> </p> When displayed in a Web browser, the control will be dimmed (a light shade of gray) to indicate that it’s unavailable. To create a read-only control, use the readonly attribute: <p>This month: <input type=”text” name=”month” value=”September” readonly=”readonly” /></p>

Quiz Develop a static personal webpage that contains bio-data, Course of study and courses. Include your likes, dislikes, hubbies, places visited/dream to visit, dream about life, best music, movies, best dishes, best novels, role model, mentors among others. Use the necessary tags taught under form as much as possible.