WHY FORMS? Explain: Mostly, when you need to collect data from a user you need a form Click: Google search form Click: Facebook login form Click:

Slides:



Advertisements
Similar presentations
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Advertisements

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.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Principles of Web Design 6 th Edition Chapter 11 – Web Forms.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Tutorial #9 – Creating Forms. Tutorial #8 Review – Tables Borders (table, gridlines), Border-collapse: collapse; empty-cells: show; and rowspan, colspan.
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.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
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.
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.
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.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
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.
FORMS How to collect information f XX rom visitors Different kinds of form controls New HTML5 form controls.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
03 – HTML (2) Informatics Department Parahyangan Catholic University.
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.
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.
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
Web Forms.
Client-Side Internet and Web Programming
>> Introduction to HTML: Forms
Web Forms.
How to Write Web Forms By Mimi Opkins.
Introduction to HTML Forms and Servlets
CS3220 Web and Internet Programming HTML Tables and Forms
HTML Forms Pat Morin COMP 2405.
FORMS IN HTML.
>> More on HTML Forms
(and available form fields)
FORMS Explained By: Sarbjit Kaur.
ITE 115 Creating Web Page Forms
Lesson 8 Week 8 Designing Forms
Designing Forms Lesson 10.
Introducing Forms.
1.5 FORMS.
Creating Form Elements
Web Development & Design Foundations with H T M L 5
Forms Data Entry and Capture
Forms, cont’d.
CNIT 131 HTML5 - Forms.
Web Development & Design Foundations with H T M L 5
CS3220 Web and Internet Programming HTML Tables and Forms
Principles of Web Design 5th Edition
Creating Forms on a Web Page
Basics of Web Design Chapter 10 Form Basics Key Concepts
Intro to Forms HTML forms are used to gather information from end-users. A form can contain elements like radio-buttons, text fields, checkboxes, submit.
Intro to Forms HTML forms are used to gather information from end-users. A form can contain elements like radio-buttons, text fields, checkboxes, submit.
© Hugh McCabe 2000 Web Authoring Lecture 8
Lesson 6: Web Forms.
Web Forms.
Unit 5 Create Forms.
Presentation transcript:

WHY FORMS? Explain: Mostly, when you need to collect data from a user you need a form Click: Google search form Click: Facebook login form Click: Amazon shipping form

FORM CONTROLS Explain: how there are different types of form control You need to choose the right type of control to get the information you need Click: ways to provide text Click: ways to make choices between fixed options Click: ways to submit information Click: how to upload files

HOW FORMS WORK Explain: Each form control has a name and a value which is sent to the server. 1: User fills in form and presses button to submit info to server

HOW FORMS WORK Explain: This is how server knows what info relates to each question. 2: Name of each form control sent with value user entered

HOW FORMS WORK Explain: How servers process information using programming language 3: Server processes information using programming language

HOW FORMS WORK Explain: The server returns a page to the user based on the information supplied in the form. Note that this will largely contain HTML & CSS. (It's not just a hand-coded page, it is based on templates.) 4: Server creates new page to send back to the browser based on info received

username=Ivy NAME & VALUE PAIRS Explain: how the server needs to know what the user entered / chose for each different form element To do this, each form element must have a name The value is what the user enters / the value associated with the choice made

username=Ivy NAME & VALUE PAIRS NAME Explain: how the server needs to know what the user entered / chose for each different form element To do this, each form element must have a name The value is what the user enters / the value associated with the choice made

username=Ivy NAME & VALUE PAIRS NAME VALUE Explain: how the server needs to know what the user entered / chose for each different form element To do this, each form element must have a name The value is what the user enters / the value associated with the choice made VALUE

FORM STRUCTURE <form action="http://example.com/join.php" method="get"> This is where the form controls will appear. </form>

FORM STRUCTURE <form action="http://example.com/join.php" method="get"> This is where the form controls will appear. </form> Explain: The action attribute shows the page the form is sent to.

FORM STRUCTURE <form action="http://example.com/join.php" method="get"> This is where the form controls will appear. </form> Explain: Describe the difference between the get and post methods.

TEXT INPUT <form action="http://example.com/join.php"> <input type="text" name="username" size="15" maxlength="30" /> </form> Explain: Several different form controls are created with the <input> element.

TEXT INPUT <form action="http://example.com/join.php"> <input type="text" name="username" size="15" maxlength="30" /> </form> Explain: The type attribute is used to indicate which type of control you want.

TEXT INPUT <form action="http://example.com/join.php"> <input type="text" name="username" size="15" maxlength="30" /> </form> Explain: The name attribute is used to tell the server which form element this is.

TEXT INPUT <form action="http://example.com/join.php"> <input type="text" name="username" size="15" maxlength="30" /> </form> Explain: The size attribute is used to specify the size of the control. (This can also be specified using CSS.) The size given does not restrict the user from adding additional characters however it can help indicate how long an entry is expected to be. For example, collecting parts of a date (2 characters) compared to an email address.

TEXT INPUT <form action="http://example.com/join.php"> <input type="text" name="username" size="15" maxlength="30" /> </form> Explain: This attribute is used to limit the number of characters a user can enter.

PASSWORD <p>Username: <input type="text" name="username" size="15" maxlength="30" /> </p> <p>Password: <input type="password" name="password" size="15" maxlength="30" /> </p>

PASSWORD <p>Username: <input type="text" name="username" size="15" maxlength="30" /> </p> <p>Password: <input type="password" name="password" size="15" maxlength="30" /> </p> Explain: The password attribute does not mean what is entered is secure. It just stops people from being able to read the characters when looking over the shoulder of the user entering them.

TEXTAREA <p>What did you think of this gig?</p> <textarea name="comments" cols="20" rows="4"> Enter your comments... <textarea/>

TEXTAREA <p>What did you think of this gig?</p> <textarea name="comments" cols="20" rows="4"> Enter your comments... <textarea/>

TEXTAREA <p>What did you think of this gig?</p> <textarea name="comments" cols="20" rows="4"> Enter your comments... <textarea/> Explain: The cols attribute sets the width of the <textarea>.

TEXTAREA <p>What did you think of this gig?</p> <textarea name="comments" cols="20" rows="4"> Enter your comments... <textarea/> Explain: The rows attribute sets the number of rows the <textarea> spans.

RADIO BUTTON <p>Your favorite genre:<br /> <input type="radio" name="genre" value="rock" checked="checked" /> Rock <input type="radio" name="genre" value="pop" /> Pop <input type="radio" name="genre" value="jazz" /> Jazz </p>

RADIO BUTTON <p>Your favorite genre:<br /> <input type="radio" name="genre" value="rock" checked="checked" /> Rock <input type="radio" name="genre" value="pop" /> Pop <input type="radio" name="genre" value="jazz" /> Jazz </p> Explain: Radio buttons allow you to pick one of several options. This example shows three options.

RADIO BUTTON <p>Your favorite genre:<br /> <input type="radio" name="genre" value="rock" checked="checked" /> Rock <input type="radio" name="genre" value="pop" /> Pop <input type="radio" name="genre" value="jazz" /> Jazz </p> Explain: Note that the name is the same for all radio buttons in the group of options.

RADIO BUTTON <p>Your favorite genre:<br /> <input type="radio" name="genre" value="rock" checked="checked" /> Rock <input type="radio" name="genre" value="pop" /> Pop <input type="radio" name="genre" value="jazz" /> Jazz </p> Explain: Note that these are different for each option (to indicate which option the user selected).

RADIO BUTTON <p>Your favorite genre:<br /> <input type="radio" name="genre" value="rock" checked="checked" /> Rock <input type="radio" name="genre" value="pop" /> Pop <input type="radio" name="genre" value="jazz" /> Jazz </p> Explain: Once an option chosen, there is no way to deselect it.

CHECKBOX <p>Your favorite music service:<br /> <input type="checkbox" name="service" value="iTunes" checked="checked" /> iTunes <input type="checkbox" name="service" value="Last.fm" /> Last.fm <input type="checkbox" name="service" value="Spotify" /> Spotify </p>

CHECKBOX <p>Your favorite music service:<br /> <input type="checkbox" name="service" value="iTunes" checked="checked" /> iTunes <input type="checkbox" name="service" value="Last.fm" /> Last.fm <input type="checkbox" name="service" value="Spotify" /> Spotify </p> Explain: Checkboxes allow users to select more than one option.

CHECKBOX <p>Your favorite music service:<br /> <input type="checkbox" name="service" value="iTunes" checked="checked" /> iTunes <input type="checkbox" name="service" value="Last.fm" /> Last.fm <input type="checkbox" name="service" value="Spotify" /> Spotify </p> Explain: Note how these names are the same for each checkbox.

CHECKBOX <p>Your favorite music service:<br /> <input type="checkbox" name="service" value="iTunes" checked="checked" /> iTunes <input type="checkbox" name="service" value="Last.fm" /> Last.fm <input type="checkbox" name="service" value="Spotify" /> Spotify </p> Explain: Note how these are different for each option (so the server knows which option the user selected).

CHECKBOX <p>Your favorite music service:<br /> <input type="checkbox" name="service" value="iTunes" checked="checked" /> iTunes <input type="checkbox" name="service" value="Last.fm" /> Last.fm <input type="checkbox" name="service" value="Spotify" /> Spotify </p>

DROP DOWN LIST BOX <select name="devices"> <option value="iPod" selected="selected">iPod</option> <option value="radio">Radio</option> <option value="PC">Computer</option> </select> Explain: Drop down list (or "select") boxes allows the user to pick one from several options. They are useful when there are long lists (e.g. a country selector) and not enough space to show each option.

DROP DOWN LIST BOX <select name="devices"> <option value="iPod" selected="selected">iPod</option> <option value="radio">Radio</option> <option value="PC">Computer</option> </select>

DROP DOWN LIST BOX <select name="devices"> <option value="iPod" selected="selected">iPod</option> <option value="radio">Radio</option> <option value="PC">Computer</option> </select>

DROP DOWN LIST BOX <select name="devices"> <option value="iPod" selected="selected">iPod</option> <option value="radio">Radio</option> <option value="PC">Computer</option> </select>

DROP DOWN LIST BOX <select name="devices"> <option value="iPod" selected="selected">iPod</option> <option value="radio">Radio</option> <option value="PC">Computer</option> </select> Explain: These attributes indicate the selected choice/s.

DROP DOWN LIST BOX <select name="devices"> <option value="iPod" selected="selected">iPod</option> <option value="radio">Radio</option> <option value="PC">Computer</option> </select> Explain: The selected attribute makes an option automatically checked upon page load.

MULTIPLE SELECT BOX <select name="devices" size="4"> <option value="guitar" selected="selected">Guitar</option> <option value="drums">Drums</option> <option value="keys" selected="selected">Keyboard</option> <option value="bass">Bass</option> </select>

MULTIPLE SELECT BOX <select name="devices" size="4"> <option value="guitar" selected="selected">Guitar</option> <option value="drums">Drums</option> <option value="keys" selected="selected">Keyboard</option> <option value="bass">Bass</option> </select> Explain: The size attribute is used to define the number of options shown in view.

FILE INPUT BOX <form action="http://eg.com/upload.php" method="post"> <p>Upload your song in MP3 format:</p> <input type="file" name="user-song" /> <input type="submit" value="upload" /> </form>

FILE INPUT BOX <form action="http://eg.com/upload.php" method="post"> <p>Upload your song in MP3 format:</p> <input type="file" name="user-song" /> <input type="submit" value="upload" /> </form>

FILE INPUT BOX <form action="http://eg.com/upload.php" method="post"> <p>Upload your song in MP3 format:</p> <input type="file" name="user-song" /> <input type="submit" value="upload" /> </form>

FILE INPUT BOX <form action="http://eg.com/upload.php" method="post"> <p>Upload your song in MP3 format:</p> <input type="file" name="user-song" /> <input type="submit" value="upload" /> </form> Explain: The method must be post for uploads.

SUBMIT BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="submit" value="Subscribe" /> </form>

SUBMIT BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="submit" value="Subscribe" /> </form>

SUBMIT BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="submit" value="Subscribe" /> </form> Explain: The value is what appears on the button. (It is important to specify this.)

IMAGE BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="image" src="images/subscribe.jpg" width="100" height="20" /> </form>

IMAGE BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="image" src="images/subscribe.jpg" width="100" height="20" /> </form>

IMAGE BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="image" src="images/subscribe.jpg" width="100" height="20" /> </form>

IMAGE BUTTON <form action="http://eg.com/email.php"> <p>Subscribe to our email list:</p> <input type="text" name="email" /> <input type="image" src="images/subscribe.jpg" width="100" height="20" /> </form> Explain: CSS can also be used to specify the size of buttons.

BUTTONS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /> </button> </form> Explain: This is a good way to combine text and images, too.

BUTTONS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /> </button> </form>

BUTTONS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /> </button> </form>

HIDDEN FORM CONTROLS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /></button> <input type="hidden" name="bookmark" value="lyrics" /> </form> Explain: Users can see the content of hidden form controls by viewing the source of the page.

HIDDEN FORM CONTROLS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /></button> <input type="hidden" name="bookmark" value="lyrics" /> </form>

HIDDEN FORM CONTROLS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /></button> <input type="hidden" name="bookmark" value="lyrics" /> </form>

HIDDEN FORM CONTROLS <form action="http://eg.com/add.php"> <button> <img src="images/add.gif" alt="add" width="10" height="20" /></button> <input type="hidden" name="bookmark" value="lyrics" /> </form>

LABELLING FORM CONTROLS <form action="http://eg.com/email.php"> <label>Age: <input type="text" name="Age" /></label> Gender: <input id="female" type="radio" name="gender" value="f" /> <label for="female">Female</label> <input id="male" type="radio" name="gender" value="m" /> <label for="female">Male</label> </form>

LABELLING FORM CONTROLS <form action="http://eg.com/email.php"> <label>Age: <input type="text" name="Age" /></label> Gender: <input id="female" type="radio" name="gender" value="f" /> <label for="female">Female</label> <input id="male" type="radio" name="gender" value="m" /> <label for="female">Male</label> </form> Explain: This is an example of implicit labelling.

LABELLING FORM CONTROLS <form action="http://eg.com/email.php"> <label>Age: <input type="text" name="Age" /></label> Gender: <input id="female" type="radio" name="gender" value="f" /> <label for="female">Female</label> <input id="male" type="radio" name="gender" value="m" /> <label for="female">Male</label> </form> Explain: This is an example of explicit labelling.

LABELLING FORM CONTROLS <form action="http://eg.com/email.php"> <label>Age: <input type="text" name="Age" /></label> Gender: <input id="female" type="radio" name="gender" value="f" /> <label for="female">Female</label> <input id="male" type="radio" name="gender" value="m" /> <label for="female">Male</label> </form> Explain: The for attribute value corresponds to the id attribute value to explain what the label is referring to.

GROUPING FORM ELEMENTS <fieldset> <legend>Contact details</legend> <label>Email:<br /> <input type="text" name="email"></label> <br /> <label>Mobile:<br /> <input type="text" name="mobile"></label> <br /> <label>Telephone:<br /> <input type="text" name="tel"></label> </fieldset>

GROUPING FORM ELEMENTS <fieldset> <legend>Contact details</legend> <label>Email:<br /> <input type="text" name="email"></label> <br /> <label>Mobile:<br /> <input type="text" name="mobile"></label> <br /> <label>Telephone:<br /> <input type="text" name="tel"></label> </fieldset> Explain: Fieldsets are particularly helpful on long forms to group controls.

GROUPING FORM ELEMENTS <fieldset> <legend>Contact details</legend> <label>Email:<br /> <input type="text" name="email"></label> <br /> <label>Mobile:<br /> <input type="text" name="mobile"></label> <br /> <label>Telephone:<br /> <input type="text" name="tel"></label> </fieldset>

HTML5: FORM VALIDATION <label for="username">Username:</label> <input type="text" name="username" required="required" /> <label for="password">Password:</label> <input type="password" name="password" required="required" /> <input type="submit" value="Submit" /> Explain: This only works in the latest browsers. (JavaScript is needed to support older browsers.)

HTML5: FORM VALIDATION <label for="username">Username:</label> <input type="text" name="username" required="required" /> <label for="password">Password:</label> <input type="password" name="password" required="required" /> <input type="submit" value="Submit" />

HTML5: DATE INPUT <label for="date">Departure date:</label> <input type="date" name="depart" id="date" /> <input type="submit" value="Submit" /> Explain: This only works in the latest browsers. Older browsers show text input and still require JavaScript validation.

HTML5: DATE INPUT <label for="date">Departure date:</label> <input type="date" name="depart" id="date" /> <input type="submit" value="Submit" />

HTML5: EMAIL & URL INPUT <input type="email" name="email" /> <input type="url" name="website" /> Explain: This only works in the latest browsers. Older browsers show text input and still require JavaScript validation. Also note how some touchscreen devices with smaller keypads will automatically show the relevant buttons for this type of control. For example, an email input will show the @ sign.

HTML5: EMAIL & URL INPUT <input type="email" name="email" /> <input type="url" name="website" />

HTML5: EMAIL & URL INPUT <input type="email" name="email" /> <input type="url" name="website" />

HTML5: SEARCH INPUT <input type="search" name="search" placeholder="Enter keyword" /> <input type="submit" value="Search" /> Explain: Older browsers show text input. Also note that the Safari browser adds styling.

HTML5: SEARCH INPUT <input type="search" name="search" placeholder="Enter keyword" /> <input type="submit" value="Search" />

HTML5: SEARCH INPUT <input type="search" name="search" placeholder="Enter keyword" /> <input type="submit" value="Search" />

SUMMARY Whenever you want to collect information from visitors you will need a form, which lives inside a <form> element. Clicks: Load individual bullets

Information from a form is sent in name/value pairs. SUMMARY Information from a form is sent in name/value pairs. Clicks: Load individual bullets

SUMMARY Each form control is given a name, and the text the user types in or the values of the options they select are sent to the server. Clicks: Load individual bullets

SUMMARY HTML5 introduces new form elements which make it easier for visitors to fill in forms. Clicks: Load individual bullets