Professional Documents
Culture Documents
Supervisor:Mr.wrya anwar
Stage 2
University Of Garmian- IT Department
1
Prepared by: Ahmad Taha
OUTLINE:
Introduction
Html forms
Html form
Attributes
3
HTML Forms
<form> is a HTML element to collect input
data with containing interactive controls. It
provides facilities to input text, number,
values, email, password, and control fields
such as checkboxes, radio buttons, submit
buttons, etc., or in other words, form is a
container that contains input elements like
text, email, number, radio buttons,
checkboxes, submit buttons, etc. Forms
are generally used when you want to
collect data from the user. For example, a
user wants to buy a bag online, so he/she
has to first enter their shipping address in
the address form and then add their
payment details in the payment form to
place an order.
Forms are created by placing input fields
within paragraphs, preformatted text, lists
and tables. This gives considerable
flexibility in designing the layout of forms.
4
<!DOCTYPE html>
<html>
<head>
<title>Page Title</title>
</head>
<body>
<h2>Welcome To GFG</h2>
<form>
<p>
</p>
5
<p>
</p>
<p>
<button type="submit">Submit</button>
6
</p>
</form>
</body>
</html>
7
Form elements
8
<optgroup>: It is used to define group-
related options in a drop-down list.
9
HTML Attributes
In this article, we will know HTML
Attributes, their implementation through
the examples. All HTML elements have
attributes that will provide additional
information about that particular element. It
takes 2 parameters, ie, a name &
a value which define the properties of the
element and are placed inside the element
tag.
The name parameter takes the name of
the property we would like to assign to the
element and the value takes the properties
value or extent of the property names that
can be aligned over the element. Every
name has some value that must be written
within quotes.
10
Input Types for
HTML Forms
There are many input types available
in HTML5. You can find the list of all input
type values here. These input types are
generally used for creating HTML Forms.
text | email | url | tel | number | range | ra
dio | color | date | month | week | time | d
atetime-local | password | submit | reset
input type="text"
HTML <input> elements with
the text type create basic, single-line
inputs. Use them when you want users to
enter a single-line value. Add
11
the required attribute to ensure that users
will fill that field.
input type="email"
The email input type is used to let the
user enter and edit an email address, or,
if the multiple attribute is defined, more
than one email addresses.
Due to the
CSS :valid and :invalid pseudo-classes,
the input value automatically shows if it is
a properly-formatted email address or not.
input type="url"
This input type is for web addresses. It is
automatically validated to ensure that it's
either empty or a properly-formatted URL
before the form can be submitted. It is
possible to use more than one URL with
the help of the multipleattribute.
12
input type="tel"
The tel input type is used to type and edit
a telephone number. This input value is
not automatically validated. It functionally
is handy with mobile browsers, because
smartphones usually recognize the input
type and change the keyboard displaying
a numeric keyboard.
input type="number"
The number input type is used to enter a
numerical value. It validates and rejects
non-numerical entries. With the help
of min, max, and step attributes you can
control the default value and set
minimum, maximum, and starting values.
13
REFERENCE:
10 Dec, 2021
HTML Attributes - GeeksforGeeks
14