HTML Forms Forms, Controls, Fields, Inputs, Submission, Validation SoftUni Team Technical Trainers Software University

Slides:



Advertisements
Similar presentations
Svetlin Nakov Telerik Corporation
Advertisements

Tutorial 6 Creating a Web Form
Supplement Creating Forms. Objectives Show how forms are used How to create the Form element HTML elements used for creating input fields.
Svetlin Nakov Telerik Corporation
Forms. Form An HTML form is a section of a document containing normal content, special elements called controls (checkboxes, radio buttons, buttons, etc.),
Doncho Minkov Technical Trainer Telerik School Academy.
HTML F ORMS. F ORMS HTML forms are used to pass data to a server. An HTML form can contain input elements like text fields, checkboxes, radio-buttons,
Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.
Chapter 10 Form Basics Key Concepts Copyright © 2013 Terry Ann Morris, Ed.D 1.
HTML 5 Tutorial Chapter 9 Form Attributes. New Form Attributes HTML5 has several new elements and attributes for forms. New form attributes : autocomplete.
1 Web Developer & Design Foundations with XHTML Chapter 6 Key Concepts.
1 Creating Web Forms in HTML Web forms collect information from customers Web forms include different control elements including: –Input boxes –Selection.
Forms and Form Controls Chapter What is a Form?
Svetlin Nakov Telerik Corporation
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.
AngularJS Routing Routes, Route Parameters, Templates, Location, Navigation SoftUni Team Technical Trainers Software University
AngularJS Services Built-in and Custom Services SoftUni Team Technical Trainers Software University
PHP Basics Course Introduction SoftUni Team Technical Trainers Software University
Fundamentals SoftUni Welcome to Software University SoftUni Team Technical Trainers Software University
Tables and Forms HTML5 Tables and Forms. Table Overview table element ( ) Attributes: align (left, right, center), bgcolor, border, cellpadding, cellspacing,
Suzanne J. Sultan Javascript Lecture 2. Suzanne J. Sultan function What is a function> Types of functions:  Function with no parameters  Function with.
CSC 2720 Building Web Applications HTML Forms. Introduction  HTML forms are used to collect user input.  The collected input is typically sent to a.
AngularJS Directives Defining Custom Directives SoftUni Team Technical Trainers Software University
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.
Tutorial 6 Working with Web Forms. XP Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create.
Test-Driven Development Learn the "Test First" Approach to Coding SoftUni Team Technical Trainers Software University
ASP.NET MVC Architecture Layouts, Filters, Sections, Helpers, Partial Views, Areas… SoftUni Team Technical Trainers Software University
Controllers and Markup Controllers, $scope, Markup, Directives, Expressions, Binding, Filters, Validation SoftUni Team Technical Trainers Software University.
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.
Asynchronous Web Services Writing Asynchronous Web Services SoftUni Team Technical Trainers Software University
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.
Sessions and Cookies State Management, Cookies, Sessions, Hidden Fields SoftUni Team Technical Trainers Software University
Web Fundamentals (HTML and CSS) Course Introduction SoftUni Team Technical Trainers Software University
Controls, Widgets, Grid…
INT222 - Internet Fundamentals Shi, Yue (Sunny) Office: T2095 SENECA COLLEGE.
Jekyll Static Site Generator Template-Based Site Generation Svetlin Nakov Technical Trainer Software University
Web Fundamentals (HTML and CSS) Course Introduction Svetlin Nakov Technical Trainer Software University
Web Technologies Lecture 3 Web forms. HTML5 forms A component of a webpage that has form controls – Text fields – Buttons – Checkboxes – Range controls.
Forms Overview, Query string, Submitting arrays, PHP & HTML, Input types, Redirecting the user Mario Peshev Technical Trainer Software.
Web Development Tools Tools for Front-End Developers Writing HTML and CSS Code SoftUni Team Technical Trainers Software University
Web Fundamentals (HTML and CSS)
Responsive Design Design that Adapts to Different Devices SoftUni Team Technical Trainers Software University
©SoftMooreSlide 1 Introduction to HTML: Forms ©SoftMooreSlide 2 Forms Forms provide a simple mechanism for collecting user data and submitting it to.
HTML5 Forms Forms are used to capture user input …
HTML Forms.
Tables, Rows, Columns, Cells, Header, Footer, Colspan, Rowspan
CSS Transitions and Animations Animated HTML Elements SoftUni Team Technical Trainers Software University
Bootstrap Front-End Framework for Responsive Web Sites Svetlin Nakov Technical Trainer Software University
Department of Computer Science, Florida State University CGS 3066: Web Programming and Design Spring Forms, HTML5 layout.
Copyright (c) 2004 Prentice-Hall. All rights reserved. 1 Committed to Shaping the Next Generation of IT Experts. Project 6: Creating XHTML Forms Kelly.
Events Event Handling in JavaScript SoftUni Team Technical Trainers Software University
1 HTML forms (cont.)
03 – HTML (2) Informatics Department Parahyangan Catholic University.
1 Web Engineering Forms Lecture 05. FORMS Its how HTML does interactivity. There are quite new feature in HTML5. But the fundamental idea does not change.
Tutorial 6 Creating a Web Form
Sets, Dictionaries SoftUni Team Technical Trainers Software University
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.
Unit 4 Working with data. Form Element HTML forms are used to pass data to a server. A form can contain input elements like text fields, checkboxes, radio-buttons,
FORMS Explained By: Jasdeep Kaur. Lecturer, Department of Computer Application, PGG.C.G., Sector: 42, Chandigarh.
Doctrine The PHP ORM SoftUni Team Technical Trainers Software University
Creating Content Defining Topic, Creating Technical Training Materials SoftUni Team Technical Trainers Software University
First Steps in PHP Creating Very Simple PHP Scripts SoftUni Team Technical Trainers Software University
2440: 141 Web Site Administration Web Forms Instructor: Joseph Nattey.
Forms, cont’d.
Presentation transcript:

HTML Forms Forms, Controls, Fields, Inputs, Submission, Validation SoftUni Team Technical Trainers Software University

2 1.HTML Forms 2.Form Fields and Fieldsets 3.Text Boxes 4.Buttons 5.Checkboxes and Radio Buttons 6.Select Fields 7.Hidden Fields 8.Sliders and Spinboxes 9.Validation Fields Table of Contents

HTML Forms Entering User Data from a Web Page

4  The primary method for gathering data from site visitors  HTML forms can hold  Text fields, drop-down lists, radio buttons, checkboxes, date / time fields, etc.  Buttons for interactions like [Register], [Login], [Search]  Sliders, range-selectors, date and time selectors, progress bars, etc… What are HTML Forms?

5  Create a form block with the tag  Example: How to Create a HTML Form? <form></form> <!-- form fields <!-- form fields come here --> come here --></form> The " action " attribute tells where the form data should be sent The " method " attribute tells how the form data should be sent – via HTTP GET or POST request

6  Single-line text input fields:  Multi-line text input fields (textarea):  Password input – a text field which masks the entered text with * signs Text Fields This is a multi-line text field This is a multi-line text field

7  Reset button – resets the form fields to their initial state  Submit button – sends the form data to the server:  Image button – submit button with image  Static button – no default action, used with JavaScript Buttons Click Me Click Me

8  Checkboxes:  Radio buttons in a group named " city ":  Only radio button from the group can be selected Checkboxes and Radio Buttons I agree I agree Sofia Sofia London London Munich Munich Madrid Madrid Rome Rome

9  Drop-down list:  Multiple-select list Select / Option Fields Male Male Female Female Other Other mouse mouse sound speakers sound speakers keyboard keyboard

10  Groups of Options Select / Optgroup Volvo Volvo Saab Saab Mercedes Mercedes Audi Audi

11  Data List Data List

12  Labels are associate an explanatory text to a form field  Labels are linked to fields through the field's ID  Clicking on a label focuses its associated field  Inputs take the cursor / checkboxes are toggled / radio buttons are checked  Labels are:  Both a usability and accessibility feature  Required in to pass accessibility validation Labels First Name First Name

13  are used to enclose a group of related form fields:  The is the fieldset's title Fieldsets Customer Details Customer Details Order Details Order Details </form>

14  Range / number inputs restricts users to enter only numbers  Additional attributes min, max, step and value  Can become spinbox or slider, depending on the input type  May be displayed differently on different browsers  May not work in some browsers (shown as normal text-boxes) Range and Spinbox

15  Hidden fields contain invisible form data  Not shown to the user, but submitted with the form  Used by JavaScript and server-side code  Not encrypted  can be easily intercepted Hidden Fields

16  Color picker  Date picker  Time picker  Date & time picker (combined) Other Input Types

17  Month + year selection  Week of the year selection  File upload  Search box Other Input Types (2)

HTML Forms Inputs Fields Live Demo

19  Autocomplete  Browser keeps the previously typed values  Readonly – the field value cannot be changed  Autofocus  The field becomes on focus on page load  Required  The field is required to be filled / selected Field Attributes for All Field Types

20  – provides a simple validation for  In a mobile device brings the keyboard  URL – has validation for URL address  In a mobile browser brings the url keyboard  Telephone – has validation for phone numbers  Brings the numeric keyboard in mobile browsers Input Fields with Validation

21  HTML input fields can use regular expression validators  Check the input values client-side, before the form submission  Server-side checks should be also performed for security reasons Regular Expressions Based Validation <input type="text" required="true" name="countryCode" title="Three letter country code" pattern="[A-Za-z]{3}" /> title="Three letter country code" pattern="[A-Za-z]{3}" />

HTML Forms Validation Live Demo

23  The tabindex controls the order in which form fields and hyperlinks are focused when pressing the [TAB] key  Default: tabindex="0" (zero) – "natural" order  If X < Y, then elements with tabindex="X" are iterated before elements with tabindex="Y"  Elements with negative tabindex are skipped, however, this is not defined in the standard Tab Index

Tab Index Live Demo

Form Submission What Happens When We Submit a Form? GET vs. POST

26  When a form is submitted:  The browser sends the form data to the server  The " action " attribute tells where to send the form  The " method " attribute tells how to send the form ( GET / POST )  GET sends the fields, encoded in the target URL:  All form fields are sent in format fieldname=fieldvalue  URL encoding is used to escape the special characters Form Submission

27  POST sends the fields in the HTTP request body: Form Submission (2) POST HTTP/1.1 Host: wordpress.com … Content-Type: application/x-www-form- urlencoded login=nakov&pwd=parola123456&rememberm e=forever&wp- submit=Log+In&redirect_to=https%3A%2F% 2Fwordpress.com%2F&testcookie=1

28  The form encryption type ( enctype )  Specifies how the browser encodes the form data Form Encryption Type (enctype) Content-Type: application/x-www-form-urlencoded application/x-www-form-urlencoded login=nakov&pwd=parola123456&remembe rme=forever&wp- submit=Log+In&redirect_to=https%3A%2 F%2Fwordpress.com%2F&testcookie=1 application/x-www-form-urlencoded mutlipart/form-data Content-Type: mutlipart/form-data WebKitFormBoundary8vsGdK01cCe1m0mC Content-Disposition: form-data; name="fileupload"; filename="logo.png" Content-Type: image/png …------WebKitFormBoundary8vsGdK01cCe1m0mC Content-Disposition: form-data; name="description" SoftUni Logo

29  HTML Forms  Created by the tag + method ( GET / POST ) + action)  GET  data sent in the URL; POST  data send in the body  Forms can hold many controls  Text boxes, text area, buttons, lists, drop-downs, check-boxes, radio-buttons, labels, field sets  Date / time / color selectors / spin boxes  Forms support regex validation Summary

? ? ? ? ? ? ? ? ? HTML Forms

License  This course (slides, examples, demos, videos, homework, etc.) is licensed under the "Creative Commons Attribution- NonCommercial-ShareAlike 4.0 International" licenseCreative Commons Attribution- NonCommercial-ShareAlike 4.0 International 31  Attribution: this work may contain portions from  "HTML Basics" course by Telerik Academy under CC-BY-NC-SA licenseHTML BasicsCC-BY-NC-SA  "CSS Styling" course by Telerik Academy under CC-BY-NC-SA licenseCSS StylingCC-BY-NC-SA

SoftUni Diamond Partners

Free Software University  Software University Foundation – softuni.orgsoftuni.org  Software University – High-Quality Education, Profession and Job for Software Developers  softuni.bg softuni.bg  Software Facebook  facebook.com/SoftwareUniversity facebook.com/SoftwareUniversity  Software YouTube  youtube.com/SoftwareUniversity youtube.com/SoftwareUniversity  Software University Forums – forum.softuni.bgforum.softuni.bg