HTML/XHTML Forms 18-Sep-18.

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.
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.
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.
16/19/2015CS120 The Information Era CS120 The Information Era Chapter 5 – Advanced HTML TOPICS: Introduction to Web Page Forms and Introductory Javascript.
16-Jul-15 HTML. 2 What is HTML? HTML stands for Hypertext Markup Language An HTML file is a text file containing markup tags The markup tags tell the.
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
Reading Data in Web Pages tMyn1 Reading Data in Web Pages A very common application of PHP is to have an HTML form gather information from a website's.
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.
CSE 382/ETE 334 Internet and Web Technology Presented By Dr. Shazzad Hosain Asst. Prof. EECS, NSU.
1 HTML Forms. 22 HTML forms provide a way for a user to send information back to the web server. Originally the user input was processed on the server.
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.
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.
1 © Netskills Quality Internet Training, University of Newcastle HTML Forms © Netskills, Quality Internet Training, University of Newcastle Netskills is.
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.
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.
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.
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.
Week 10: HTML Forms HNDIT11062 – Web Development.
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. Objectives You will be able to: Compose HTML forms, to accept input from the user. Identify the different kinds of input tags that can appear.
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.
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.
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.
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.
XP Tutorial 6New Perspectives on HTML, XHTML, and DHTML, Comprehensive 1 Creating Web Page Forms Designing a Product Registration Form Tutorial 6.
Tutorial 6 Working with Web Forms
Client-Side Internet and Web Programming
How to Write Web Forms By Mimi Opkins.
Introduction to HTML Forms and Servlets
CS3220 Web and Internet Programming HTML Tables and Forms
Forms Web Design Ms. Olifer.
HTML Forms Pat Morin COMP 2405.
>> More on HTML Forms
Introduction to Web programming
(and available form fields)
FORMS Explained By: Sarbjit Kaur.
HTML IV (Forms) Robin Burke ECT 270.
ITE 115 Creating Web Page Forms
ARUSHA TECHNICAL COLLEGE WEB DESIGN(html forms)
Designing Forms Lesson 10.
Introducing Forms.
1.5 FORMS.
HTML Forms and User Input
HTML: Basic Tags & Form Tags
Creating Form Elements
Web Development & Design Foundations with H T M L 5
Forms Data Entry and Capture
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.
Forms, cont’d.
CNIT 131 HTML5 - Forms.
CS3220 Web and Internet Programming HTML Tables and Forms
Creating Forms on a Web Page
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.
HTML Forms 18-Apr-19.
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
HTML: Basic Tags & Form Tags
Presentation transcript:

HTML/XHTML Forms 18-Sep-18

What are forms? <form> is just another kind of XHTML/HTML tag Forms are used to create (rather primitive) GUIs on Web pages Usually the purpose is to ask the user for information The information is then sent back to the server A form is an area that can contain form elements The syntax is: <form parameters> ...form elements... </form> Form elements include: buttons, checkboxes, text fields, radio buttons, drop-down menus, etc Other kinds of tags can be mixed in with the form elements A form usually contains a Submit button to send the information in he form elements to the server The form’s parameters tell JavaScript how to send the information to the server (there are two different ways it could be sent) Forms can be used for other things, such as a GUI for simple programs

Forms and JavaScript The JavaScript language can be used to make pages that “do something” You can use JavaScript to write complete programs, but... Usually you just use snippets of JavaScript here and there throughout your Web page JavaScript code snippets can be attached to various form elements For example, you might want to check that a zipcode field contains a 5-digit integer before you send that information to the server Microsoft calls its version of JavaScript “active scripting” Forms can be used without JavaScript, and JavaScript can be used without forms, but they work well together JavaScript for forms is covered in a separate lecture

The <form> tag The <form arguments> ... </form> tag encloses form elements (and probably other elements as well) The arguments to form tell what to do with the user input action="url" (required) Specifies where to send the data when the Submit button is clicked method="get" (default) Form data is sent as a URL with ?form_data info appended to the end Can be used only if data is all ASCII and not more than 100 characters method="post" Form data is sent in the body of the URL request Cannot be bookmarked by most browsers target="target" Tells where to open the page sent as a result of the request target= _blank means open in a new window target= _top means use the same window

The <input> tag Most, but not all, form elements use the input tag, with a type="..." argument to tell which kind of element it is type can be text, checkbox, radio, password, hidden, submit, reset, button, file, or image Other common input tag arguments include: name: the name of the element id: a unique identifier for the element value: the “value” of the element; used in different ways for different values of type readonly: the value cannot be changed disabled: the user can’t do anything with this element Other arguments are defined for the input tag but have meaning only for certain values of type

Text input A text field: <input type="text" name="textfield" value="with an initial value" /> A multi-line text field <textarea name="textarea" cols="24" rows="2">Hello</textarea> A password field: <input type="password" name="textfield3" value="secret" /> • Note that two of these use the input tag, but one uses textarea

Buttons submit: send data A submit button: <input type="submit" name="Submit" value="Submit" /> A reset button: <input type="reset" name="Submit2" value="Reset" /> A plain button: <input type="button" name="Submit3" value="Push Me" /> submit: send data reset: restore all form elements to their initial state button: take some action as specified by JavaScript • Note that the type is input, not “button”

Radio buttons Radio buttons:<br> <input type="radio" name="radiobutton" value="myValue1" /> male<br> <input type="radio" name="radiobutton" value="myValue2” checked="checked" />female If two or more radio buttons have the same name, the user can only select one of them at a time This is how you make a radio button “group” If you ask for the value of that name, you will get the value specified for the selected radio button As with checkboxes, radio buttons do not contain any text

Labels In many cases, the labels for controls are not part of the control <input type="radio" name="gender" value="m" />male In this case, clicking on the word “male” has no effect A label tag will bind the text to the control <label><input type="radio" name="gender" value="m" />male</label> Clicking on the word “male” now clicks the radio button w3schools says that you should use the for attribute: <label for="lname">Last Name:</label> <input type="text" name="lastname" id="lname" /> In my testing (Firefox and Opera), this isn’t necessary, but it may be for some browsers Labels also help page readers read the page correctly Some browsers may render labels differently

Checkboxes type: "checkbox" A checkbox: <input type="checkbox" name="checkbox" value="checkbox" checked="checked"> type: "checkbox" name: used to reference this form element from JavaScript value: value to be returned when element is checked Note that there is no text associated with the checkbox Unless you use a label tag, only clicking on the box itself has any effect

Drop-down menu or list A menu or list: <select name="select"> <option value="red">red</option> <option value="green">green</option> <option value="BLUE">blue</option> </select> Additional arguments: size: the number of items visible in the list (default is "1") multiple if set to "true" (or just about anything else), any number of items may be selected if omitted, only one item may be selected if set to "false", behavior depends on the particular browser

Hidden fields <input type="hidden" name="hiddenField" value="nyah"> <-- right there, don't you see it? What good is this? All input fields are sent back to the server, including hidden fields This is a way to include information that the user doesn’t need to see (or that you don’t want her to see) The value of a hidden field can be set programmatically (by JavaScript) before the form is submitted

A complete example <html> <head> <title>Get Identity</title> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> </head> <body> <p><b>Who are you?</b></p> <form method="post" action=""> <p>Name: <input type="text" name="textfield"> </p> <p>Gender: <label><input type="radio" name="gender" value="m" />Male<label> <label><input type="radio" name="gender" value="f" />Female</label> </p> </form> </body> </html>

The End