New Form Elements and Attributes

Slides:



Advertisements
Similar presentations
Lecture 6/2/12. Forms and PHP The PHP $_GET and $_POST variables are used to retrieve information from forms, like user input When dealing with HTML forms.
Advertisements

Ch3: Introduction to HTML5 part 2 Dr. Abdullah Almutairi ISC 340 Fall 2014.
Introduction to Online Data Collection (OLDC) Community Based Abstinence Education September, 2009.
Video, audio, embed, iframe, HTML Form
CHAPTER 30 THE HTML 5 FORMS PROCESSING. LEARNING OBJECTIVES What the three form elements are How to use the HTML 5 tag to specify a list of words’ form.
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.
Kabel Nathan Stanwicks, Head Circulation and Media Services Department Electronic Reserves Introductory Tutorial for Faculty.
Creating Web Page Forms
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
Before you begin If a yellow security bar appears at the top of the screen in PowerPoint, click Enable Editing. You need PowerPoint 2010 to view this presentation.
Form Handling, Validation and Functions. Form Handling Forms are a graphical user interfaces (GUIs) that enables the interaction between users and servers.
Internet & World Wide Web How to Program, 5/e Copyright © Pearson, Inc All Rights Reserved.
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.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
1 Entering Grades and Indicators in the Standards-Based Report Card (SBRC) Users Manual for SBRC On-line Entry Interim Progress ReportsInterim Progress.
Neal Stublen Improvements  New form elements  Assist with validation  Consistency across sites  Changes reduce the need for common.
XHTML Introductory1 Forms Chapter 7. XHTML Introductory2 Objectives In this chapter, you will: Study elements Learn about input fields Use the element.
Moodle (Course Management Systems). Assignments 1 Assignments are a refreshingly simple method for collecting student work. They are a simple and flexible.
SERVER web page repository WEB PAGE instructions stores information and instructions BROWSER retrieves web page and follows instructions Server Web Server.
CHAP 3. FORM API.  Forms should still be encapsulated in a element where the basic submission attributes are set.  Forms still send the values of the.
Creating a Web Site to Gather Data and Conduct Research.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
XP 1 Microsoft Word 2002 Tutorial 1 – Creating a Document.
 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.
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.
Creating a Web Site Using 000webhost.com The 000webhost.com Site You will be required to create an account in order to use their host computer 000webhost.com.
Button and Textbox. Input  Input objects are used to obtain input from the user viewing the webpage. They allow the user to interact with the Web. 
 2008 Pearson Education, Inc. All rights reserved JavaScript: Introduction to Scripting.
INTRODUCTION TO HTML5 New HTML5 User Interface and Attributes.
HTML 5 Form elements Basharat Mahmood, Department of Computer Science,CIIT,Islamabad, Pakistan. 1.
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 Structure II (Form) WEEK 2.2. Contents Table Form.
Chapter 5 Using a Template to Create a Resume and Sharing a Finished Document Microsoft Word 2013.
How to search and how to upload files into sentry file
MIS 3200 – C# (C Sharp)
HTML CS 4640 Programming Languages for Web Applications
JavaScript, Sixth Edition
Unit & District Tools Phase 1
HTML 5.
Creating Oracle Business Intelligence Interactive Dashboards
UW-Superior V10.7 for Instructors
CIIT-Human Computer Interaction-CSC456-Fall-2015-Mr
HTML Forms Pat Morin COMP 2405.
>> More on HTML Forms
Introduction to Scripting
Tutorial 1 – Creating a Document
Central Document Library Quick Reference User Guide View User Guide
IS333: MULTI-TIER APPLICATION DEVELOPMENT
HTML Forms and User Input
Objectives Explore web forms Work with form servers
Playing Audio (Part 1).
What is Cookie? Cookie is small information stored in text file on user’s hard drive by web server. This information is later used by web browser to retrieve.
MODULE 7 Microsoft Access 2010
Browser Support for HTML5
WEB PROGRAMMING JavaScript.
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.
New Form Input Types.
Creating Forms on a Web Page
HTML5 Form Types – Newer Available Fields
Shelly Cashman: Microsoft Word 2016
Brandon Roman CS300.
© Hugh McCabe 2000 Web Authoring Lecture 8
Journal of Mountain Science (JMS)
PHP-II.
Report Subscription.
HTML CS 4640 Programming Languages for Web Applications
Unit 5 Create Forms.
Presentation transcript:

New Form Elements and Attributes

The <placeholder> Attribute HTML5 enables us to help out our web users when filling out a form. One way is by using the placeholder attribute: <form> Name: <input type="text" size="30" name="fullname" placeholder="John Smith"><br> Phone: <input type="text" size="20" name="phone" placeholder="xxx-xxx-xxxx"><br> <input type="submit" value="Submit"> </form> Someone filling out the form might be uncertain whether a full name or just a first name is expected. Likewise, phone numbers come in many formats. By providing the user with visual samples, we are making their task easier. Chrome 25.0 Placeholders – also known as watermarks – appear as faded text. Once the user clicks on the field and begins typing, the content disappears. If the field is left blank, the placeholder text is ignored and not submitted with the form. Browsers that do not support this feature, such as IE9, will provide blank fields and disregard the placeholders.

The <autofocus> Attribute By adding the autofocus attribute to one of the form's fields, we can make the browser load the page with the cursor on that field: <form> Name: <input type="text" size="30" name="fullname" placeholder="John Smith" autofocus><br> Phone: <input type="text" size="20" name="phone" placeholder="xxx-xxx-xxxx"><br> <input type="submit" value="Submit"> </form> Now the first field in our form gets immediate focus, allowing the user to begin typing. Without this feature, the user would have to click on the field or press the [Tab] key before typing. Chrome 25.0 To web designers, the new placeholder and autofocus attributes in HTML5 are very welcome. Previously, these features could be implemented only by using JavaScript, which often resulted in quirky or inconsistent behavior. Have you ever clicked on a web form and begun typing, only to have the cursor suddenly jump to some other field? This annoyance was due to JavaScript running after the page was loaded, and will likely become a thing of the past with the new autofocus feature in HTML5.

The <required> Attribute The required attribute allows us to specify which fields in a form must be completed and which can be left blank: <form> Name: <input type="text" size="30" name="fullname" placeholder="John Smith" required><br> Phone: <input type="text" size="20" name="phone" placeholder="xxx-xxx-xxxx"><br> <input type="submit" value="Submit"> </form> The form now requires that the user enter something into the Name field before the form can be submitted. Do you see the problem? There is no way for the user to know which fields are required and which aren't. Let's help them out: Chrome 25.0 <form> Name*: <input type="text" size="30" name="fullname" placeholder="John Smith" required><br> Phone: <input type="text" size="20" name="phone" placeholder="xxx-xxx-xxxx"><br> * Indicates required field.<br> <input type="submit" value="Submit"> </form>

The <required> Attribute Now the user has a clear understanding of the minimum requirements to submit the form. So what happens when the form is submitted with a required field left blank? Browsers that support the required attribute will stop the user in their tracks: Chrome 25.0 Firefox 19.0 Chrome 25.0 Internet Explorer added support for the required attribute only in version 10.0, so users with IE9 or earlier will not see this feature work (i.e. the browser will allow the form to be submitted with blank data.)

The <spellcheck> Attribute With HTML5, we can override the browser's default spellchecking behavior: Favorite Movie: <input type="text" size="40" name="movie" spellcheck="true"> Chrome 25.0 Most browsers enable spellchecking by default. By adding the above line, we are explicitly requesting that the spellcheck feature be activated. We may also switch the feature off for a field. Perhaps we expect users to enter unusual data and don't want to annoy them with the red squiggly lines: Favorite Movie: <input type="text" size="40" name="movie" spellcheck="false"> Chrome 25.0 Beginning with version 10.0, Internet Explorer now supports the spellcheck attribute.

The <autocomplete> Attribute Many browsers look for identical field names in forms and automatically offer to populate them with data the user entered on prior web forms. This can be a time saver, as users don't have to retype their name, address, phone number, email, etc. each time they encounter a new web form. This feature, however, can be a security risk for some fields. Examples include social security number, DOB, credit card number, and password. We can switch the autocomplete feature on or off at the form level, the field level, or both: <form autocomplete="false"> Credit Card Number: <input type="text" size="40" name="cc" autocomplete="false"> <form autocomplete="false"> Name: <input type="text" size="30" name="name" autocomplete="true"> DOB: <input type="text" size="30" name="dob"> Credit Card Number: <input type="text" size="40" name="cc"> </form> The final example disables autocomplete on the entire form except for the field specified.

The <datalist> Element The datalist element is new to HTML5 and allows us to make a list of suggestions for completing a text box, while still allowing users to type in their own answer: Car Brand: <input type="text" name="car" list="brands"> <datalist id="brands"> <option value="Ford"> <option value="General Motors"> <option value="Chrysler"> <option value="Toyota"> <option value="Nissan"> <option value="Honda"> </datalist> Firefox 19.0 The list attribute of the input element must match the id attribute of the datalist element. As the user begins typing, the list of suggestions will be reduced to those pre-defined options that still have a match to the characters typed. Browsers that don't support the datalist element (such as IE9 and earlier) will simply disregard the suggestions and offer a blank text box to the user.

The <progress> Element The progress element is also new to HTML5 and allows us to show a "percentage of completion" bar for anything that has a start and a finish: Upload progress: <progress value="58" max="100">58%</progress> Firefox 19.0 Internet Explorer 9.0 When we declare the value and max attributes, the browser can calculate the percentage and display the progress bar accordingly. Browsers that support the progress element will ignore any text between the opening and closing tags. Those that do not support the element (IE9 and earlier) will ignore the tags and display only the text between them. In this way, we have a clever fallback for older browsers. Modifying the percentage of completion and thus moving the progress bar along is accomplished via JavaScript, which we will not cover in this course.