CSE 154 LECTURE 9: FORMS. Web data most interesting web pages revolve around data examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes can.

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.
24-Aug-14 HTML Forms. 2 What are forms? is just another kind of HTML tag HTML forms are used to create (rather primitive) GUIs on Web pages Usually the.
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.
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.
Video, audio, embed, iframe, HTML Form
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.
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.
Form Basics CS Web Data  Most interesting web pages revolve around data  examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes  can.
USER INTERACTIONS: FORMS
Tutorial 6 Forms Section A - Working with Forms in JavaScript.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Forms, Validation Week 7 INFM 603. Announcements Try placing today’s example in htdocs (XAMPP). This will allow you to execute examples that rely on PHP.
CST JavaScript Validating Form Data with JavaScript.
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.
Advance Database Management Systems Lab no. 5 PHP Web Pages.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Chapter 5 Java Script And Forms JavaScript, Third Edition.
Chapter 6: Forms JavaScript - Introductory. Previewing the Product Registration 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.
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.
JavaScript, Fourth Edition Chapter 5 Validating Form Data with JavaScript.
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.
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.
Tutorial 6 Working with Web Forms. 2New Perspectives on HTML, XHTML, and XML, Comprehensive, 3rd Edition Objectives Explore how Web forms interact with.
Copyright © Terry Felke-Morris WEB DEVELOPMENT & DESIGN FOUNDATIONS WITH HTML5 7 TH EDITION Chapter 9 Key Concepts 1 Copyright © Terry Felke-Morris.
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.
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.
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.
HTML Forms.
Week 10: HTML Forms HNDIT11062 – Web Development.
Lecture 8: Events and timers
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
CSE 154 LECTURE 18: FORMS AND UPLOADING FILES. Exercise: Baby name web service JSON Modify our babynames.php service to produce its output as JSON. For.
HTML FORM. Form HTML Forms are used to select different kinds of user input. HTML forms are used to pass data to a server. A form can contain input elements.
HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.
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 Tables Tables are defined with the tag. A table is divided into rows (with the tag), and each row is divided into data cells (with the tag). td stands.
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
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.
Lecture 16: File I/O; Functions
CS3220 Web and Internet Programming HTML Tables and Forms
Lecture 9: Events and timers
Validation and Building Small Apps
Introducing Forms.
CS3220 Web and Internet Programming HTML Tables and Forms
Lecture 7: Unobtrusive JavaScript
The Internet 10/27/11 XHTML Forms
Lecture 8: Events and timers
Presentation transcript:

CSE 154 LECTURE 9: FORMS

Web data most interesting web pages revolve around data examples: Google, IMDB, Digg, Facebook, YouTube, Rotten Tomatoes can take many formats: text, HTML, XML, multimedia many of them allow us to access their data some even allow us to submit our own new data most server-side web programs accept parameters that guide their execution

Query strings and parameters URL?name=value&name=value query string: a set of parameters passed from a browser to a web server often passed by placing name/value pairs at the end of a URL above, parameter username has value obourn, and sid has value PHP code on the server can examine and utilize the value of parameters a way for PHP code to produce different output based on values passed by the user

Query parameters: $_GET, $_POST $user_name = $_GET["username"]; $id_number = (int) $_GET["id"]; $eats_meat = FALSE; if (isset($_GET["meat"])) { $eats_meat = TRUE; } PHP $_GET["parameter name"] or $_POST["parameter name"] returns a GET/POST parameter's value as a string parameters specified as are GET parameters test whether a given parameter was passed with isset

Example: Exponents $base = $_GET["base"]; $exp = $_GET["exponent"]; $result = pow($base, $exp); print "$base ^ $exp = $result"; PHP exponent.php?base=3&exponent=4 3 ^ 4 = 81 output

Example: Print all parameters $value) { ?> Parameter has value PHP print_params.php?name=Allison+Obourn&sid= Parameter name has value Allison Obourn Parameter sid has value output or call print_r or var_dump on $_GET for debugging

HTML forms form: a group of UI controls that accepts information from the user and sends the information to a web server the information is sent to the server as a query string JavaScript can be used to create interactive controls (seen later)

HTML form: form controls HTML 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

Form example Let's search Google: HTML Let's search Google: output must wrap the form's controls in a block element such as div

Form controls: HTML output input element is used to create many UI controls an inline element that MUST be self-closed name attribute specifies name of query parameter to pass to server type can be button, checkbox, file, hidden, password, radio, reset, submit, text,... value attribute specifies control's initial text

Text fields: NetID Password HTML output 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

Text boxes: a multi-line text input area (inline) Type your comments here. HTML 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 output

Checkboxes: yes/no choices that can be checked and unchecked (inline) Lettuce Tomato Pickles HTML 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 output

Radio buttons: sets of mutually exclusive choices (inline) Visa MasterCard American Express HTML output grouped by name attribute (only one can be checked at a time) must specify a value for each one or else it will be sent as value on

Text labels: Visa MasterCard American Express HTML 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 output

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

Using for lists Jerry George Kramer Elaine Newman HTML 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 output

Option groups: Jerry George Kramer Elaine Newman Susan HTML What should we do if we don't like the bold appearance of the optgroup s? output

Reset buttons Name: Food: Meat? HTML output when clicked, returns all form controls to their initial values specify custom text on the button by setting its value attribute

Hidden input parameters Name SID HTML 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 output

Grouping input:, groups of input fields with optional caption (block) Credit cards: Visa MasterCard American Express HTML fieldset groups related input fields, adds a border; legend supplies a caption output

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

Problems with submitting data Visa MasterCard Favorite Star Trek captain: James T. Kirk Jean-Luc Picard HTML this form submits to our handy params.php tester page the form may look correct, but when you submit it... [cc] => on, [startrek] => Jean-Luc Picard HTML

The value attribute Visa MasterCard Favorite Star Trek captain: James T. Kirk Jean-Luc Picard HTML value attribute sets what will be submitted if a control is selected [cc] => visa, [startrek] => picard HTML