Chapter 6 Basic forms 1. Forms and query string 2 form : a group of user input (UI) controls that accepts information from the user and sends the information.

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
More forms CS Reset Buttons  specify custom text on the button by setting its value attribute CS380 2 Name: Food: Meat? HTML.
SE-2840 Dr. Mark L. Hornick 1 HTML input elements and forms.
Technologies for web publishing Ing. Václav Freylich Lecture 4.
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
USER INTERACTIONS: FORMS
Outline IS400: Development of Business Applications on the Internet Fall 2004 Instructor: Dr. Boris Jukic Table, Forms, Metatags and Frames.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
XHTML Forms for Data Collection and Submission Chapter 5.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
CSE 154 LECTURE 9: FORMS. Web data most interesting web pages revolve around data examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes can.
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.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
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.
HTML - Forms By Joaquin Vila, Ph.D.. Form Tag The FORM tag specifies a fill-out form within an HTML document. More than one fill-out form can be in a.
Tables and Forms HTML5 Tables and Forms. Table Overview table element ( ) Attributes: align (left, right, center), bgcolor, border, cellpadding, cellspacing,
Basics of Web Design 1 Copyright © 2016 Pearson Education, Inc., Hoboken NJ.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
Tutorial 7 Creating Forms. Objectives Session 7.1 – Create an HTML form – Insert fields for text – Add labels for form elements – Create radio buttons.
INTRODUCTORY Tutorial 8 Creating Forms. XP New Perspectives on Blended HTML, XHTML, and CSS2 Objectives Create an HTML form Create fields for text Create.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
 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.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
HTML - Forms By Joaquin Vila, Ph.D.. Form Tag The FORM tag specifies a fill-out form within an HTML document. More than one fill-out form can be in a.
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.
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.
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.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
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.
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
SYST Web Technologies SYST Web Technologies XHTML Forms.
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.
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
HTML Forms.
HTML FORMS Basharat Mahmood, Department of Computer Science,CIIT,Islamabad,Pakistan. 1.
20-753: Fundamentals of Web Programming 1 Lecture 6: Advanced HTML Fundamentals of Web Programming Lecture 6: Advanced HTML.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
CSE 154 LECTURE 7: THE DOCUMENT OBJECT MODEL (DOM); UNOBTRUSIVE JAVASCRIPT.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
Introduction to Web Site Development Department of Computer Science California State University, Los Angeles Lecture 8: Forms and Controls.
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.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Objectives Design a form Create a form Create text fields
CS3220 Web and Internet Programming HTML Tables and 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.
Lecture 9: Events and timers
Introducing Forms.
Forms, cont’d.
CS3220 Web and Internet Programming HTML Tables and Forms
Basics of Web Design Chapter 10 Form Basics Key Concepts
The Internet 10/27/11 XHTML Forms
Lecture 8: Events and timers
Presentation transcript:

Chapter 6 Basic forms 1

Forms and query string 2 form : a group of user input (UI) controls that accepts information from the user and sends the information to a web server HTML has tags to create a collection of objects that implement this information gathering These objects are called widgets or controls or components (e.g., buttons, checkboxes, text fields, etc.) When the Submit button of a form is clicked, the form’s values are sent to the server for processing the information is sent to the server as a query string parameter embedded in the URL of the HTTP get or in the body of the HTTP post request. JavaScript can be used to create interactive controls (seen later)

HTML form: HTML form: 3 All of the widgets, or components of a form are defined in the content of a tag The only required action attribute gives the URL of the page that will process this form's data when form has been filled out and submitted, its data will be sent to the action's URL one page may contain many forms if so desired If the form has no action, the value of action is the empty string The method attribute of specifies one of the two possible techniques of transferring the form data to the server, get and post – Discussed later on in the server side scripting section form controls form controls

Form example 4 Many of the form controls / widgets (text, buttons, etc) are created using the HTML input element  The type attribute of specifies the kind of widget being created Every form should have a submit button, when clicked the browser builds a query string and submits it to that URL. Should wrap the form's controls in a block element such as div Let's search Google:

Form controls: Form controls: 5 input element is an inline element that MUST be self-closed – name attribute specifies name of query parameter to pass to server and should be unique – type can be button, checkbox, file, hidden, password, radio, reset, submit, text,... (default is text) – value attribute specifies control's initial text. If not set for submit, it will be Submit Query Type your Google query:

Text fields: Text fields: 6 input attributes: disabled, maxlength, readonly, size, value size attribute controls onscreen width of text field maxlength limits how many characters user is able to type into field NetID Password

Text boxes: Text boxes: 7 initial text is placed inside textarea tag (optional) required rows and cols attributes specify height/width in characters optional readonly attribute means text cannot be modified by default the text wrap to the next line. Type your comments here. a multi-line text input area (inline) initial text

Checkboxes: Checkboxes: 8 none, 1, or many checkboxes can be checked at same time when sent to server, any checked boxes will be sent with value on : use checked="checked" attribute in HTML to initially check the box Lettuce Tomato Pickles yes/no choices that can be checked and unchecked (inline)

Radio buttons: Radio buttons: 9 grouped by name attribute (only one can be checked at a time) – So the browser will ensure that only one radio buttons can be checked from a group must specify a value for each one or else it will be sent as value on sets of mutually exclusive choices (inline) Visa MasterCard American Express

Text labels: Text labels: 10 associates nearby text with control, so you can click text to activate control can be used with checkboxes or radio buttons label element can be targeted by CSS style rules It can nest a control element Also you can give each a control an id and then a label placed anywhere in the page can target that control by placing a for attribute inside it and giving that attribute the same value as the id. Visa MasterCard American Express … Visa … click me to check the bold box

Drop-down list:, Drop-down list:, 11 option element represents each choice select optional attributes: disabled, multiple, size optional selected attribute sets which one is initially chosen menus of choices that collapse and expand (inline) Jerry George Kramer Elaine

Using for lists 12 optional multiple attribute allows selecting multiple items with shift- or ctrl-click – must declare parameter's name with [] if you allow multiple selections option tags can be set to be initially selected Jerry George Kramer Elaine Newman

Option groups: Option groups: 13 Jerry George Kramer Elaine Newman Susan

Reset buttons 14 Name: Meal: Meat? when clicked, returns all form controls to their initial values specify custom text on the button by setting its value attribute print_params.php is a php server side script that you can write to print the data submitted by the client to the server (discussed in server side scripting part)

Common UI control errors 15 “I changed the form's HTML code... but when I refresh, the page doesn't update! “ – By default, when you refresh a page, it leaves the previous values in all form controls – it does this in case you were filling out a long form and needed to refresh/return to it – if you want it to clear out all UI controls' state and values, you must do a full refresh Firefox: Shift-Ctrl-R Mac: Shift-Command-R

Grouping input:, Grouping input:, 16 fieldset groups related input fields; legend supplies an optional caption Login Information User Name Password groups of input fields with optional caption (block)

Hidden input parameters 17 Name: Meal: Meat? an invisible parameter that is still passed to the server when form is submitted useful for passing on additional state that isn't modified by the user

Styling form controls 18 input[type="text"] { background-color: yellow; font-weight: bold; } attribute selector: matches only elements that have a particular attribute value useful for controls because many share the same element ( input ) element[attribute="value"] { property : value;... property : value; }

Styling Text Boxes 19 body { height: 100%; } textarea { position: absolute; width: 50%; height: 15%; } HTML validator requires rows and cols on a textarea if you want a textarea at a specific width/height in pixels or %, you must specify rows/cols in the HTML and width/height in the CSS – the rows/cols will be ignored but must be there anyway... – sometimes specifying a height on the page's body helps – sometimes using absolute/fixed positioning on the textarea helps

Styled form example 20 fieldset { background-color: #ffffcc; margin-left: auto; margin-right: auto; width: 21em; } form { font-family: "Helvetica", sans-serif; } input { margin-bottom: 0.5em; } input[type="submit"] { font-weight: bold; margin-left: 10em; } New User Signup Name: Address: Credit Card: Visa MasterCard label.heading { float: left; margin-right: 1em; text-align: right; width: 7em; } legend { background-color: white; border: 1px solid black; padding: 0.25em; }