SlideShare a Scribd company logo
HTML Form Controls
OBJECTIVES
 To understand the concept of Form in HTML.
 To understand about different controls in Form.
 To understand about the different attributes of form in HTML.
 To understand about the form tag which is used in HTML.
HTML Form
An HTML form is a section of a document containing normal
content, markup, special elements called controls (checkboxes,
radio buttons, menus, textarea ,text etc.), and labels on those
controls. Users generally "complete" a form by modifying its
controls (entering text, selecting menu items, etc.), before
submitting the form to an agent for processing (e.g., to a Web
server, to a mail server, etc.).
Attributes of Form
Form Attributes Description
action Backend script ready to process your passed data.
method Method to be used to upload data. The most frequently used are GET and POST methods.
target Specify the target window or form where the result of the script will be displayed. It takes values
like _blank, _self, _parent etc.
HTML Form Controls
There are different types of form controls that you can use to collect data using HTML form
−:
1. Text Input Controls
2. Submit Button/ Clickable Buttons Controls( image button)
3. Checkboxes Controls
4. Radio Box Controls
5. Drop-down list or select controls
6. Field set / Grouping Form Controls
7. HTML output Tag
8. File upload controls
9. Some Other Input Type attributes in Form
1. Text Input Controls
Input text controls are used to collect User data as a free text. On the web page, it will form a
rectangle box where Users can input the data. There are different types of input text controls that
can be used in the HTML forms. There are three types of text input used on forms −
1. Single-line text input controls − This control is used for items that require only one line of
user input, such as search boxes or names. They are created using HTML <input> tag. This allows the
user to enter only a single line of data. A typical example of such input text controls is for entering
the name, search box, city, etc.
2. Password input controls − This is also a single-line text input but it masks the character as soon
as a user enters it. They are also created using HTMl <input> tag. As the name suggests this is typically
used for the password field. This works in the same way as the input text field but the text gets
masked for safety purposes.
3. Multi-line text input controls − This is used when the user is required to give details that may
be longer than a single sentence. Multi-line input controls are created using HTML <textarea> tag.
This input control type allows the user to enter data of multiple lines. Typical usage of such input
controls is for comments, addresses, description and so on.
Attributes of Text Input
Sr.No Attribute & It's Description
1type (Common for all controls)
Indicates the type of input control and for text input control it will be set to text.
2name (Common for all controls)
Used to give a name to the control which is sent to the server to be recognized and get the
value.
3value (Common for all controls)
This can be used to provide an initial value inside the control.
4size (Common for Text, Password and Text area)
Allows to specify the width of the text-input control in terms of characters.
5maxlength (Common for Text, Password and Text area)
Allows to specify the maximum number of characters a user can enter into the text box.
6rows (Use for Multiline Controls)
Indicates the number of rows of text area box.
7cols (Use for Multiline Controls)
Indicates the number of columns of text area box
1. Single-line text input controls −
<html>
<body>
<form>
Userid:
<input type="text" name="uid">
<br>
Password:
<input type="text" name="upwd">
</form>
</body>
</html>
2. Password input controls −
<html>
<body>
<form>
Userid:
<input type="text" name="uid">
<br>
Password:
<input type="password" name="upwd">
</form>
</body>
</html>
3. Multi-line text input controls −
<html>
<body>
<form>
Userid:
<input type="text" name="uid">
<br>
Password:
<input type="password" name="upwd">
<br>
description:
<textarea rows="5" cols="20" name="describe"> Enter Description Here
</textarea>
</form>
</body>
</html>
2. Button Input Controls
A submit button is used to send the form data to a web server. When submit button is clicked the form data is
sent to the file specified in the form's action attribute to process the submitted data. A reset button resets all
the forms control to default values.
Sr.No Type & It's Description
1submit
Form submit buttons usually send the form data to the script that was specified in the action attribute of the form tag.
2reset
The reset button type is used to reset the contents of the form to their original values. This means that each form field will change
back to the value it had when the form loaded – either null (empty), or the default value set with the value attribute.
3button
This creates a button that is used to trigger a client-side script when the user clicks that button.
4image
This creates a clickable button but we can use an image as background of the button. It is use some other attributes like:
src -: this attributes used to set an image on button.
width -: set the width of image.
height -: set the height of image.
border -: set the border of image.
align -: set the alignment of image button.
hspace -: set hspace of image.
vspace -: set vspace of image.
Button Example:
<html>
<body>
<form>
<label for="Userid">User ID:</label>
<input type="text" name="uid">
<br>
<label for="password">Password:</label>
<input type="password" name="upwd"> <br>
<input type="submit" name="go" value="Go">
<input type="reset" value="form reset">
<input type="image" name="payu" value="pay to click" src="pay.jpg" width="30" height="30" border="5">
<input type="button" name="Ok" value="Button Click">
</form>
</body>
</html>
3. Check Box Controls
Sr.No Type & It's Description
1
checked
Set to checked if you want to select it by default.
A checkbox lets the User select whatever information is true in his case. It is a very convenient way of
accepting the data when the possible input is already known. For example, if you want to select your hobbies
so that checkbox is good input control to selection of your hobbies.Checkboxes are used when more than one
option is required to be selected.
Checkbox Example
<html>
<head>
<title>Hobbies</title>
</head>
<body>
<p> Select Your Hobbies-------::: </p>
<form>
<input type = "checkbox" name = "Hacking" value = "on" checked="checked"> Hacking <br>
<input type = "checkbox" name = "Music" value = "on"> Music <br>
<input type = "checkbox" name = "Reading" value = "on"> Reading <br>
<input type = "checkbox" name = "Writing" value = "on"> Writing <br>
<input type = "checkbox" name = "Fashion" value = "on"> Fashion <br>
<input type = "checkbox" name = "Ice Skating" value = "on"> Ice Skating <br>
<input type = "checkbox" name = "Graphic Design" value = "on"> Graphic Design <br>
<input type = "checkbox" name = "Bowling" value = "on"> Bowling <br>
</form>
</body>
</html>
4. Radio Button Controls
Sr.No Type & It's Description
1
checked
Set to checked if you want to select it by default.
Radio buttons are used when you expect Users to fill data as a Boolean value or you expect only one input as
true out of multiple options. Some common use case of radio buttons is gender determination which is male or
female and employee type (Regular / Adhoc / Visiting) and so on. Radio buttons are used when out of many
options, just one option is required to be selected.
RadioButton Example
<html>
<head>
<title>Hobbie</title>
</head>
<body>
<form>
<p> Gender </p>
<input type = "radio" name = "gender" id="male"> male <br>
<input type = "radio" name = "gender" id="female"> female <br>
<p> Employee Type </p>
<input type = "radio" name = "type" value = "r1"> Regular <br>
<input type = "radio" name = "type" value = "ad"> Adhoc <br>
<input type = "radio" name = "type" value = "vi"> Visting <br>
</form>
</body>
</html>
5. Drop Down List
A drop-down list (abbreviated drop-down; also known as a drop-down menu, drop menu, pull-down list, pick
list) is a graphical control element, similar to a list box, that allows the user to choose one value from a list.
When a drop-down list is inactive, it displays a single value.
Attribute Value Description
id Select id Defines which form the drop-down list belongs to
multiple multiple The HTML <select> multiple attribute is a Boolean Attribute. It specifies that the
user is allowed to select more than one value that presents in <select> element.
name name Defines a name for the drop-down list
required required Specifies that the user is required to select a value before submitting the form
number number Defines the number of visible options in a drop-down list
Drop Down List Example
<html>
<body>
<h1> Drop Down List Example </h1>
<p>Drop Down List is create a list</p>
<label for=“state">Select State:</label>
<select id=“state">
<option value=“UP">UP</option>
<option value=“MP">MP</option>
<option value=“Delhi">Delhi</option>
<option value=“Chhattisgarh"> Chhattisgarh </option>
</select>
</body>
</html>
6. Field Set
The <fieldset> tag in HTML5 is used to make a group of related elements in the form and it creates the box
over the elements. The <fieldset> tag is new in HTML5. The HTML <fieldset> tag is found within the <form>
tag and is used to group related elements in an HTML form. Use a <legend> tag to create a caption for the
<fieldset>.This tag is also commonly referred to as the <fieldset> element.
Attribute Value Description
align left
right
center
top
bottom
Deprecated − Specifies the content alignment.
disabled disabled Specifies that a group of related form elements should be disabled.
form form_id Specifies forms which belongs to fieldset.
name text Specifies a name for fieldset.
Field Set
<html>
<head>
<title>Field Set Tag used as a group box or box</title>
</head>
<body>
<form>
<fieldset>
<legend>Employee Information</legend>
Employee id: <input type = "text" name="eid"><br>
Employee Name:<input type = "text" name="ename"><br>
Eage:<input type = "text" name = "eage"> <br>
Esite:<input type = "url" name = "esite">
</fieldset>
</form>
</body>
</html>
7. HTML output Tag
The <output> tag is one of the HTML5 elements. It defines a place for representing the result of a
calculation performed by a script or user’s interaction with a form element (<form> tag). The <output> tag
is designed for complex calculations, new tag in HTML 5 and it requires a starting and end tag.
Attribute Description
for This attribute contains an attribute value element_id which is used to specify the relation between result
and calculations.
form This attribute contains an attribute value form_id which is used to specify the one or more forms of output
elements.
name This attribute contains an attribute value name which is used to specify the name of output element.
Oninput This attributes is used to store input value of form controls.
Output Tag:
<html>
<form
oninput="sum1.value=parseInt(t1.value)+parseInt(t2.value)+parseInt(t3.value)+parseInt(t4.value)+parseInt
(t5.value)">
<label for="Marks"> Enter Hindi Marks </label><br>
<input type="number" name="t1" value=""><br>
<label for="Marks"> Enter English Marks </label><br>
<input type="number" name="t2" value=""><br>
<label for="Marks"> Enter Chemistry Marks </label><br>
<input type="number" name="t3" value=""><br>
<label for="Marks"> Enter Physics Marks </label><br>
<input type="number" name="t4" value=""><br>
<label for="Marks"> Enter History Marks </label><br>
<input type="number" name="t5" value=""><br><br>
Sum of Five Subject Marks:<output name="sum1"></output> <br>
</form>
</html>
1. Input type Color
8. File upload controls
The upload form is a very practical form to allow the users to send photos, documents or any other kind of
files to the server.To create an upload form we will only have to establish the file value to the <input
type=“file"> tag.
Attribute Description
Type Mention attributes type means it is file ,text,number etc.
<form action="1.txt">
<label for="txt">Text File Output:</label>
<input type="file" name="txt" id="t1"><br><br>
<input type="submit" value="Submit">
</form>
<form action="1.jpg">
<label for=“img">Image file Output:</label>
<input type="file" name=“img" id=“i1"><br><br>
<input type="submit" value="Submit">
</form>
<form action="1.docx">
<label for=“doc">Document File:</label>
<input type="file" name=“doc" id=“d1"><br><br>
<input type="submit" value="Submit">
</form>
9. Some Other Input Type attributes in Form
Attribute Value Description
type hidden
number
text
radio
checkbox
Color
Date
Email
url
Button
File
Image
Password
Month
Range
Reset
Tel
Time
Week
A control that is not displayed but whose value is submitted to the server.
A control for entering a number.
A control for entering a text.
A control used for single selection at a time.
A control used for multiple selection at a time.
A control for entering a color
A control for entering a date.
A field for editing an email address.
A control for entering a url.
A control for used button.
A control that lets the user select a file.
A control for entering a image on button.
A single-line text field whose value is obscured. Will alert user if site is not secure.
A control for entering a month.
Displays as a range of given value.
A button that resets the contents of the form to default values. Not recommended.
A control for entering a telephone number.
A control for entering a time.
A control for entering a week.
<html>
<form>
enter week<input type="week" name="w"><br> <br> <br>
enter month<input type="month" name="m"> <br> <br> <br>
enter email<input type="email" name="e"> <br><br> <br>
enter color<input type="color" name="c"><br> <br> <br>
enter date<input type="date" name="d"> <br> <br> <br>
enter range<input type="range" name="r"> <br> <br> <br>
enter tel<input type="tel" name="t"> <br> <br> <br>
enter time<input type="time" name="t"> <br> <br> <br>
<label for="ename">Employee Name:</label> <br> <br> <br>
<input type="text" id="ename" name="e1"><br><br><br>
<input type="hidden" id="eid" name="eid" value="101"><br>
<input type="submit" value="Submit">
</form>
</html>
Html Form Controls
Html Form Controls
Thank You
Ad

More Related Content

What's hot (20)

Dom
DomDom
Dom
Rakshita Upadhyay
 
Datatype in JavaScript
Datatype in JavaScriptDatatype in JavaScript
Datatype in JavaScript
Rajat Saxena
 
Introduction to Javascript
Introduction to JavascriptIntroduction to Javascript
Introduction to Javascript
Amit Tyagi
 
Web design - Working with forms in HTML
Web design - Working with forms in HTMLWeb design - Working with forms in HTML
Web design - Working with forms in HTML
Mustafa Kamel Mohammadi
 
CSS - Text Properties
CSS - Text PropertiesCSS - Text Properties
CSS - Text Properties
hstryk
 
CSS
CSSCSS
CSS
People Strategists
 
Css selectors
Css selectorsCss selectors
Css selectors
Parth Trivedi
 
CSS Selectors
CSS SelectorsCSS Selectors
CSS Selectors
Rachel Andrew
 
html-table
html-tablehtml-table
html-table
Dhirendra Chauhan
 
Html table tags
Html table tagsHtml table tags
Html table tags
eShikshak
 
html-css
html-csshtml-css
html-css
Dhirendra Chauhan
 
Java script
Java scriptJava script
Java script
Shyam Khant
 
Document Object Model
Document Object ModelDocument Object Model
Document Object Model
baabtra.com - No. 1 supplier of quality freshers
 
Images and Tables in HTML
Images and Tables in HTMLImages and Tables in HTML
Images and Tables in HTML
Aarti P
 
Introduction to JavaScript
Introduction to JavaScriptIntroduction to JavaScript
Introduction to JavaScript
Andres Baravalle
 
JavaScript - Chapter 12 - Document Object Model
  JavaScript - Chapter 12 - Document Object Model  JavaScript - Chapter 12 - Document Object Model
JavaScript - Chapter 12 - Document Object Model
WebStackAcademy
 
Css types internal, external and inline (1)
Css types internal, external and inline (1)Css types internal, external and inline (1)
Css types internal, external and inline (1)
Webtech Learning
 
CSS Basics
CSS BasicsCSS Basics
CSS Basics
WordPress Memphis
 
4. listbox
4. listbox4. listbox
4. listbox
chauhankapil
 
Basic html
Basic htmlBasic html
Basic html
Nicha Jutasirivongse
 

Similar to Html Form Controls (20)

HTML Forms
HTML FormsHTML Forms
HTML Forms
Nisa Soomro
 
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
Ahmed Saihood
 
Html forms
Html formsHtml forms
Html forms
Abhishek Kesharwani
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
Mudasir Syed
 
Html form
Html formHtml form
Html form
Jaya Kumari
 
Html forms
Html formsHtml forms
Html forms
eShikshak
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
gunjansingh599205
 
HTML - FORMS.pptx
HTML - FORMS.pptxHTML - FORMS.pptx
HTML - FORMS.pptx
Nyssakotian
 
Html class-04
Html class-04Html class-04
Html class-04
Md Ali Hossain
 
HTML Forms: The HTML element represents a document section containing interac...
HTML Forms: The HTML element represents a document section containing interac...HTML Forms: The HTML element represents a document section containing interac...
HTML Forms: The HTML element represents a document section containing interac...
BINJAD1
 
Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and input
Jesus Obenita Jr.
 
lecture9-10-160807085530.pptx dgdg fdgdfv ds
lecture9-10-160807085530.pptx dgdg fdgdfv dslecture9-10-160807085530.pptx dgdg fdgdfv ds
lecture9-10-160807085530.pptx dgdg fdgdfv ds
drpreetiwctm
 
20 html-forms
20 html-forms20 html-forms
20 html-forms
Kumar
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
Palakshya
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
Abhishek Kesharwani
 
html forms
html formshtml forms
html forms
ikram niaz
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
Steve Guinan
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
Julie Iskander
 
HTML
HTML HTML
HTML
Emertxe Information Technologies Pvt Ltd
 
HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.
MohammadRafsunIslam
 
Ad

More from Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi) (20)

String Manipulation Function and Header File Functions
String Manipulation Function and Header File FunctionsString Manipulation Function and Header File Functions
String Manipulation Function and Header File Functions
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C Structure and Union in C
C Structure and Union in CC Structure and Union in C
C Structure and Union in C
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Preprocessor Directive in C
Preprocessor Directive in CPreprocessor Directive in C
Preprocessor Directive in C
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
File Handling in C Programming
File Handling in C ProgrammingFile Handling in C Programming
File Handling in C Programming
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Bit field enum and command line arguments
Bit field enum and command line argumentsBit field enum and command line arguments
Bit field enum and command line arguments
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Pointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory AllocationPointers in C and Dynamic Memory Allocation
Pointers in C and Dynamic Memory Allocation
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Array in C
Array in CArray in C
Array in C
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C storage class
C storage classC storage class
C storage class
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Function in C Programming
Function in C ProgrammingFunction in C Programming
Function in C Programming
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)C Constructs (C Statements & Loop)
C Constructs (C Statements & Loop)
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C Operators
C OperatorsC Operators
C Operators
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
C programming Basics
C programming BasicsC programming Basics
C programming Basics
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Software Development Skills and SDLC
Software Development Skills and SDLCSoftware Development Skills and SDLC
Software Development Skills and SDLC
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Mobile commerce
Mobile commerceMobile commerce
Mobile commerce
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
E commerce application
E commerce applicationE commerce application
E commerce application
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Data normalization
Data normalizationData normalization
Data normalization
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Security issue in e commerce
Security issue in e commerceSecurity issue in e commerce
Security issue in e commerce
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
ER to Relational Mapping
ER to Relational MappingER to Relational Mapping
ER to Relational Mapping
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Entity Relationship Model
Entity Relationship ModelEntity Relationship Model
Entity Relationship Model
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Database connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwariDatabase connectivity with data reader by varun tiwari
Database connectivity with data reader by varun tiwari
Bosco Technical Training Society, Don Bosco Technical School (Aff. GGSIP University, New Delhi)
 
Ad

Recently uploaded (20)

UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
Operations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdfOperations Management (Dr. Abdulfatah Salem).pdf
Operations Management (Dr. Abdulfatah Salem).pdf
Arab Academy for Science, Technology and Maritime Transport
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
SPRING FESTIVITIES - UK AND USA -
SPRING FESTIVITIES - UK AND USA            -SPRING FESTIVITIES - UK AND USA            -
SPRING FESTIVITIES - UK AND USA -
Colégio Santa Teresinha
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptxYSPH VMOC Special Report - Measles Outbreak  Southwest US 4-30-2025.pptx
YSPH VMOC Special Report - Measles Outbreak Southwest US 4-30-2025.pptx
Yale School of Public Health - The Virtual Medical Operations Center (VMOC)
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACYUNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
UNIT 3 NATIONAL HEALTH PROGRAMMEE. SOCIAL AND PREVENTIVE PHARMACY
DR.PRISCILLA MARY J
 
To study the nervous system of insect.pptx
To study the nervous system of insect.pptxTo study the nervous system of insect.pptx
To study the nervous system of insect.pptx
Arshad Shaikh
 
How to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 WebsiteHow to Subscribe Newsletter From Odoo 18 Website
How to Subscribe Newsletter From Odoo 18 Website
Celine George
 
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Phoenix – A Collaborative Renewal of Children’s and Young People’s Services C...
Library Association of Ireland
 
How to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odooHow to Set warnings for invoicing specific customers in odoo
How to Set warnings for invoicing specific customers in odoo
Celine George
 
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 AccountingHow to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
How to Customize Your Financial Reports & Tax Reports With Odoo 17 Accounting
Celine George
 
Metamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative JourneyMetamorphosis: Life's Transformative Journey
Metamorphosis: Life's Transformative Journey
Arshad Shaikh
 
Presentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem KayaPresentation of the MIPLM subject matter expert Erdem Kaya
Presentation of the MIPLM subject matter expert Erdem Kaya
MIPLM
 
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - WorksheetCBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
CBSE - Grade 8 - Science - Chemistry - Metals and Non Metals - Worksheet
Sritoma Majumder
 
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Niamh Lucey, Mary Dunne. Health Sciences Libraries Group (LAI). Lighting the ...
Library Association of Ireland
 
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
World war-1(Causes & impacts at a glance) PPT by Simanchala Sarab(BABed,sem-4...
larencebapu132
 
How to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of saleHow to manage Multiple Warehouses for multiple floors in odoo point of sale
How to manage Multiple Warehouses for multiple floors in odoo point of sale
Celine George
 
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulsepulse  ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
pulse ppt.pptx Types of pulse , characteristics of pulse , Alteration of pulse
sushreesangita003
 
GDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptxGDGLSPGCOER - Git and GitHub Workshop.pptx
GDGLSPGCOER - Git and GitHub Workshop.pptx
azeenhodekar
 
P-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 finalP-glycoprotein pamphlet: iteration 4 of 4 final
P-glycoprotein pamphlet: iteration 4 of 4 final
bs22n2s
 
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptxSCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
SCI BIZ TECH QUIZ (OPEN) PRELIMS XTASY 2025.pptx
Ronisha Das
 
Anti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptxAnti-Depressants pharmacology 1slide.pptx
Anti-Depressants pharmacology 1slide.pptx
Mayuri Chavan
 

Html Form Controls

  • 2. OBJECTIVES  To understand the concept of Form in HTML.  To understand about different controls in Form.  To understand about the different attributes of form in HTML.  To understand about the form tag which is used in HTML.
  • 3. HTML Form An HTML form is a section of a document containing normal content, markup, special elements called controls (checkboxes, radio buttons, menus, textarea ,text etc.), and labels on those controls. Users generally "complete" a form by modifying its controls (entering text, selecting menu items, etc.), before submitting the form to an agent for processing (e.g., to a Web server, to a mail server, etc.).
  • 4. Attributes of Form Form Attributes Description action Backend script ready to process your passed data. method Method to be used to upload data. The most frequently used are GET and POST methods. target Specify the target window or form where the result of the script will be displayed. It takes values like _blank, _self, _parent etc.
  • 5. HTML Form Controls There are different types of form controls that you can use to collect data using HTML form −: 1. Text Input Controls 2. Submit Button/ Clickable Buttons Controls( image button) 3. Checkboxes Controls 4. Radio Box Controls 5. Drop-down list or select controls 6. Field set / Grouping Form Controls 7. HTML output Tag 8. File upload controls 9. Some Other Input Type attributes in Form
  • 6. 1. Text Input Controls Input text controls are used to collect User data as a free text. On the web page, it will form a rectangle box where Users can input the data. There are different types of input text controls that can be used in the HTML forms. There are three types of text input used on forms − 1. Single-line text input controls − This control is used for items that require only one line of user input, such as search boxes or names. They are created using HTML <input> tag. This allows the user to enter only a single line of data. A typical example of such input text controls is for entering the name, search box, city, etc. 2. Password input controls − This is also a single-line text input but it masks the character as soon as a user enters it. They are also created using HTMl <input> tag. As the name suggests this is typically used for the password field. This works in the same way as the input text field but the text gets masked for safety purposes. 3. Multi-line text input controls − This is used when the user is required to give details that may be longer than a single sentence. Multi-line input controls are created using HTML <textarea> tag. This input control type allows the user to enter data of multiple lines. Typical usage of such input controls is for comments, addresses, description and so on.
  • 7. Attributes of Text Input Sr.No Attribute & It's Description 1type (Common for all controls) Indicates the type of input control and for text input control it will be set to text. 2name (Common for all controls) Used to give a name to the control which is sent to the server to be recognized and get the value. 3value (Common for all controls) This can be used to provide an initial value inside the control. 4size (Common for Text, Password and Text area) Allows to specify the width of the text-input control in terms of characters. 5maxlength (Common for Text, Password and Text area) Allows to specify the maximum number of characters a user can enter into the text box. 6rows (Use for Multiline Controls) Indicates the number of rows of text area box. 7cols (Use for Multiline Controls) Indicates the number of columns of text area box
  • 8. 1. Single-line text input controls − <html> <body> <form> Userid: <input type="text" name="uid"> <br> Password: <input type="text" name="upwd"> </form> </body> </html>
  • 9. 2. Password input controls − <html> <body> <form> Userid: <input type="text" name="uid"> <br> Password: <input type="password" name="upwd"> </form> </body> </html>
  • 10. 3. Multi-line text input controls − <html> <body> <form> Userid: <input type="text" name="uid"> <br> Password: <input type="password" name="upwd"> <br> description: <textarea rows="5" cols="20" name="describe"> Enter Description Here </textarea> </form> </body> </html>
  • 11. 2. Button Input Controls A submit button is used to send the form data to a web server. When submit button is clicked the form data is sent to the file specified in the form's action attribute to process the submitted data. A reset button resets all the forms control to default values. Sr.No Type & It's Description 1submit Form submit buttons usually send the form data to the script that was specified in the action attribute of the form tag. 2reset The reset button type is used to reset the contents of the form to their original values. This means that each form field will change back to the value it had when the form loaded – either null (empty), or the default value set with the value attribute. 3button This creates a button that is used to trigger a client-side script when the user clicks that button. 4image This creates a clickable button but we can use an image as background of the button. It is use some other attributes like: src -: this attributes used to set an image on button. width -: set the width of image. height -: set the height of image. border -: set the border of image. align -: set the alignment of image button. hspace -: set hspace of image. vspace -: set vspace of image.
  • 12. Button Example: <html> <body> <form> <label for="Userid">User ID:</label> <input type="text" name="uid"> <br> <label for="password">Password:</label> <input type="password" name="upwd"> <br> <input type="submit" name="go" value="Go"> <input type="reset" value="form reset"> <input type="image" name="payu" value="pay to click" src="pay.jpg" width="30" height="30" border="5"> <input type="button" name="Ok" value="Button Click"> </form> </body> </html>
  • 13. 3. Check Box Controls Sr.No Type & It's Description 1 checked Set to checked if you want to select it by default. A checkbox lets the User select whatever information is true in his case. It is a very convenient way of accepting the data when the possible input is already known. For example, if you want to select your hobbies so that checkbox is good input control to selection of your hobbies.Checkboxes are used when more than one option is required to be selected.
  • 14. Checkbox Example <html> <head> <title>Hobbies</title> </head> <body> <p> Select Your Hobbies-------::: </p> <form> <input type = "checkbox" name = "Hacking" value = "on" checked="checked"> Hacking <br> <input type = "checkbox" name = "Music" value = "on"> Music <br> <input type = "checkbox" name = "Reading" value = "on"> Reading <br> <input type = "checkbox" name = "Writing" value = "on"> Writing <br> <input type = "checkbox" name = "Fashion" value = "on"> Fashion <br> <input type = "checkbox" name = "Ice Skating" value = "on"> Ice Skating <br> <input type = "checkbox" name = "Graphic Design" value = "on"> Graphic Design <br> <input type = "checkbox" name = "Bowling" value = "on"> Bowling <br> </form> </body> </html>
  • 15. 4. Radio Button Controls Sr.No Type & It's Description 1 checked Set to checked if you want to select it by default. Radio buttons are used when you expect Users to fill data as a Boolean value or you expect only one input as true out of multiple options. Some common use case of radio buttons is gender determination which is male or female and employee type (Regular / Adhoc / Visiting) and so on. Radio buttons are used when out of many options, just one option is required to be selected.
  • 16. RadioButton Example <html> <head> <title>Hobbie</title> </head> <body> <form> <p> Gender </p> <input type = "radio" name = "gender" id="male"> male <br> <input type = "radio" name = "gender" id="female"> female <br> <p> Employee Type </p> <input type = "radio" name = "type" value = "r1"> Regular <br> <input type = "radio" name = "type" value = "ad"> Adhoc <br> <input type = "radio" name = "type" value = "vi"> Visting <br> </form> </body> </html>
  • 17. 5. Drop Down List A drop-down list (abbreviated drop-down; also known as a drop-down menu, drop menu, pull-down list, pick list) is a graphical control element, similar to a list box, that allows the user to choose one value from a list. When a drop-down list is inactive, it displays a single value. Attribute Value Description id Select id Defines which form the drop-down list belongs to multiple multiple The HTML <select> multiple attribute is a Boolean Attribute. It specifies that the user is allowed to select more than one value that presents in <select> element. name name Defines a name for the drop-down list required required Specifies that the user is required to select a value before submitting the form number number Defines the number of visible options in a drop-down list
  • 18. Drop Down List Example <html> <body> <h1> Drop Down List Example </h1> <p>Drop Down List is create a list</p> <label for=“state">Select State:</label> <select id=“state"> <option value=“UP">UP</option> <option value=“MP">MP</option> <option value=“Delhi">Delhi</option> <option value=“Chhattisgarh"> Chhattisgarh </option> </select> </body> </html>
  • 19. 6. Field Set The <fieldset> tag in HTML5 is used to make a group of related elements in the form and it creates the box over the elements. The <fieldset> tag is new in HTML5. The HTML <fieldset> tag is found within the <form> tag and is used to group related elements in an HTML form. Use a <legend> tag to create a caption for the <fieldset>.This tag is also commonly referred to as the <fieldset> element. Attribute Value Description align left right center top bottom Deprecated − Specifies the content alignment. disabled disabled Specifies that a group of related form elements should be disabled. form form_id Specifies forms which belongs to fieldset. name text Specifies a name for fieldset.
  • 20. Field Set <html> <head> <title>Field Set Tag used as a group box or box</title> </head> <body> <form> <fieldset> <legend>Employee Information</legend> Employee id: <input type = "text" name="eid"><br> Employee Name:<input type = "text" name="ename"><br> Eage:<input type = "text" name = "eage"> <br> Esite:<input type = "url" name = "esite"> </fieldset> </form> </body> </html>
  • 21. 7. HTML output Tag The <output> tag is one of the HTML5 elements. It defines a place for representing the result of a calculation performed by a script or user’s interaction with a form element (<form> tag). The <output> tag is designed for complex calculations, new tag in HTML 5 and it requires a starting and end tag. Attribute Description for This attribute contains an attribute value element_id which is used to specify the relation between result and calculations. form This attribute contains an attribute value form_id which is used to specify the one or more forms of output elements. name This attribute contains an attribute value name which is used to specify the name of output element. Oninput This attributes is used to store input value of form controls.
  • 22. Output Tag: <html> <form oninput="sum1.value=parseInt(t1.value)+parseInt(t2.value)+parseInt(t3.value)+parseInt(t4.value)+parseInt (t5.value)"> <label for="Marks"> Enter Hindi Marks </label><br> <input type="number" name="t1" value=""><br> <label for="Marks"> Enter English Marks </label><br> <input type="number" name="t2" value=""><br> <label for="Marks"> Enter Chemistry Marks </label><br> <input type="number" name="t3" value=""><br> <label for="Marks"> Enter Physics Marks </label><br> <input type="number" name="t4" value=""><br> <label for="Marks"> Enter History Marks </label><br> <input type="number" name="t5" value=""><br><br> Sum of Five Subject Marks:<output name="sum1"></output> <br> </form> </html> 1. Input type Color
  • 23. 8. File upload controls The upload form is a very practical form to allow the users to send photos, documents or any other kind of files to the server.To create an upload form we will only have to establish the file value to the <input type=“file"> tag. Attribute Description Type Mention attributes type means it is file ,text,number etc.
  • 24. <form action="1.txt"> <label for="txt">Text File Output:</label> <input type="file" name="txt" id="t1"><br><br> <input type="submit" value="Submit"> </form> <form action="1.jpg"> <label for=“img">Image file Output:</label> <input type="file" name=“img" id=“i1"><br><br> <input type="submit" value="Submit"> </form> <form action="1.docx"> <label for=“doc">Document File:</label> <input type="file" name=“doc" id=“d1"><br><br> <input type="submit" value="Submit"> </form>
  • 25. 9. Some Other Input Type attributes in Form Attribute Value Description type hidden number text radio checkbox Color Date Email url Button File Image Password Month Range Reset Tel Time Week A control that is not displayed but whose value is submitted to the server. A control for entering a number. A control for entering a text. A control used for single selection at a time. A control used for multiple selection at a time. A control for entering a color A control for entering a date. A field for editing an email address. A control for entering a url. A control for used button. A control that lets the user select a file. A control for entering a image on button. A single-line text field whose value is obscured. Will alert user if site is not secure. A control for entering a month. Displays as a range of given value. A button that resets the contents of the form to default values. Not recommended. A control for entering a telephone number. A control for entering a time. A control for entering a week.
  • 26. <html> <form> enter week<input type="week" name="w"><br> <br> <br> enter month<input type="month" name="m"> <br> <br> <br> enter email<input type="email" name="e"> <br><br> <br> enter color<input type="color" name="c"><br> <br> <br> enter date<input type="date" name="d"> <br> <br> <br> enter range<input type="range" name="r"> <br> <br> <br> enter tel<input type="tel" name="t"> <br> <br> <br> enter time<input type="time" name="t"> <br> <br> <br> <label for="ename">Employee Name:</label> <br> <br> <br> <input type="text" id="ename" name="e1"><br><br><br> <input type="hidden" id="eid" name="eid" value="101"><br> <input type="submit" value="Submit"> </form> </html>