SlideShare a Scribd company logo
Tutorial 9
Creating Forms
Data Collection and Processing
• An HTML form is a collection of HTML
elements used to gather data that a user
enters online.
• When a user clicks a form’s submit button to
send the data, the form connects to a form
handler—software that runs on a Web file
server and processes the form.
Processing a Web Form
Creating a Form
• Every form begins with the start <form> tag and
ends with the closing </form> tag, which must
be within the document <body></body> tags.
• The <form> tag has several attributes and
values, including a unique id for the form.
• The action attribute in the <form> tag
identifies the location on the server where you’ll
send the data.
• The method attribute tells the browser how to
submit the form information.
Creating a Form
• A form can be created using the following
code:
<form id = "idvalue"
method = "methodtype"
action = "script_url"></form>
where
– idvalue is the name of the form
– methodtype is either get or post
– script_url is the location on the file server
where the script will be run when the form is
submitted
The get and post Methods
• The default get method sends the data in the
form directly to the server by appending the
data to the URL.
• Using the post method, the browser contacts
the server, and then the data in the form is
sent to the server.
• The post method is more secure than the
get method.
The text Element
• The syntax for creating a text box is:
<input type = "texttype" name = "name"
id = "id" value = "initialvalue"
size = "sizevalue"
maxlength = "maxvalue" />
where
– texttype is text, password, email, or any valid
value
– initialvalue is the default data that appears in
the field
– sizevalue is the width of the box in characters
– maxvalue is the maximum number of characters
that a user can type in the field
The fieldset Element
• To organize form elements using the
fieldset and legend elements, the
following code is used:
<fieldset><legend>legendtext</legend>
form elements
</fieldset>
where
– legendtext is the text for the legend
– form elements is the code for the form
controls grouped together
Form Container
• The form container can be formatted in the
same way the other HTML elements can be
formatted.
Styling the form and
formcontainer Selectors
Determining Input Types
• A field represents a single kind of data.
• A user enters data into each field in a form
based on prompting text—a short description
that suggests what data belongs in a certain
field.
• The label element is used to display prompting
text on the screen.
• The input element is used to determine the
type of data a control collects.
Determining Input Types
• The label element is used together with the input
element.
– The label element uses the for attribute, which associates
the label with the id value in the input element.
<label for = “lastname”>Last Name</label>
<input type = “text” name=“lastname” id=“lastname” />
• The type attribute determines the specific type of form
object that is created:
– text input
– a check box
– an option button
– another form object.
Creating Text Boxes
• The text box control is used to gather
alphanumeric data (letters or numbers) as a
single line of text in a form.
• Use the type attribute with a value of text
to create a single-line text box.
• Another type of single-line text field is a
password field, where input is masked.
• The type attribute value for the password
field is password.
Organizing Form Controls Example
Email Text Box
• Another type of single-line text field is an
email text box, where input is masked.
• The type attribute value for the email text
box is email.
• The default length for the text boxes is 20
characters.
• The size attribute is used to make the email
text box longer.
Stylizing Form Controls
Setting a Value in a Text Box
• The value attribute is used to set an initial
value of a text box control.
• The value of the value attribute appears in
the text box when the Web page opens.
Setting a Placeholder Value
• Some Web browsers recognize the
placeholder attribute and display its value
in a light grey color.
• The placeholder attribute allows you to
display a sample email address in the input
box.
Creating Option Buttons
• A radio button lets users make only a single
choice from a group of options.
• The input type for an option button is radio.
• Each option button would appear to the right
of each label.
• The option buttons that form one group all
have the same name attribute and value.
• The value attribute is used by the program
on the server when the form is submitted.
Creating Option Buttons
• To create option buttons, the following code is used for
each one:
<input type = "radio" name = "name"
id = "id" value = "field_data" />
where
– name identifies the corresponding field in the database
– id associates the field with the for attribute in the label
element
– field_data is the data that will be sent to the appropriate
field in the database if the button is selected
• To specify that an option button is checked by default,
add the attribute and value checked = "checked"
to the <input> tag code.
Option Buttons Example
<fieldset>
<legend>Personal Information</legend>
<input type = "radio" name = "gender" id = "hungry"
value = "hungry" checked = "checked" />
<label for = "hungry">Hungry</label>
</fieldset>
Creating Check Boxes
• A check box is a form control that allows a
user to choose none, one, or more than one
item from a group.
• The input type for a check box is checkbox.
• A check box is named to correspond to the
field name in the database that receives the
data when a user selects that check box.
• Each check box should have a different name
attribute.
Creating Check Boxes
• The code for creating check boxes is:
<input type = "checkbox" name = "name"
id = "id" value = "data" />
where
– name identifies the check box field with a field in the
database
– id associates the field with the for attribute in the
label element
– data is the data that will be sent to the database if the
check box is selected
• To specify that a check box is checked by default, add
the attribute and value checked = "checked"
to the tag.
Check Boxes Example
Creating a Selection List
• A selection list is a form control that displays all the
items in a list and allows a user to choose from the
list.
• A drop-down list box displays only one item in a
selection list; the user clicks a list arrow to display the
remaining contents of the list and to make a
selection.
• The select element is used to create a selection
list.
Creating a Selection List
• The option element is used to define each
menu choice within a selection list.
• An option element’s value attribute and
its value determine the data that is sent to the
form handler.
• The option text is the text that appears in the
browser as a choice in the selection list.
Creating a Selection List
• The code for creating a selection list is:
<select name = "name" id = "id">
<option value = "value1">optiontext1
</option>
<option value = "value2">optiontext2
</option>
…
</select>
where
– name identifies a field in the database
– id identifies the value for the for attribute in the label element
– optiontext1 and optiontext2 are choices in the option list
– value1 and value2 are the values sent to the program on the server
when the form is submitted
Creating a Selection List – Special
Considerations
• More than one item in the list to appear in the
browser
– use size = "number", where number is the number
of items you want to display in the selection list.
• Allow user to select more than one choice
– use multiple = "multiple" in the <select> tag
code.
• Default choice
– use selected = "selected" in the <option> tag
code.
Selection List Example
Creating a Text Area
• A text area is a control that allows users to enter
more than one line of alphanumeric input.
• The textarea element is used to create a multiline
text field.
• A text area allows users to enter comments that
suggest how to improve a particular service or the
form itself, or to provide other feedback.
Creating a Text Area
• The code for creating a text area is:
<textarea name = "name"
id = "id" rows = "height_value"
cols = "width_value"></textarea>
where
– name identifies the field in the database associated
with the text area
– id associates this field with the for attribute value in
the label element
– height_value is the number of rows
– width_value is the character width of the text area
expressed as a number
Text Area Example
Submitting Data
• A command button is a form control that lets a user
execute or cancel an action.
• A submit button is used to submit the form data to
the specified action location.
<input type = "submit"
value = "buttontext" />
• A reset button clears or resets the form fields to the
default values so the user can cancel the input in the
form and start over.
<input type = "reset"
value = "buttontext" />
Styling Submit and Reset Buttons
Submitted Data Example

More Related Content

What's hot

HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form
Sandhika Galih
 
HTML Dasar : #5 Heading
HTML Dasar : #5 HeadingHTML Dasar : #5 Heading
HTML Dasar : #5 Heading
Sandhika Galih
 
HTML Dasar : #6 List
HTML Dasar : #6 ListHTML Dasar : #6 List
HTML Dasar : #6 List
Sandhika Galih
 
Updated html programs
Updated html programsUpdated html programs
Updated html programs
Deepali54
 
UG Degree Certificate
UG Degree CertificateUG Degree Certificate
UG Degree CertificateKumar P
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
danpaquette
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Formstina1357
 
Tema 6 - Formularios en html
Tema 6 - Formularios en htmlTema 6 - Formularios en html
Tema 6 - Formularios en htmlPamela Rodriguez
 
Intro to html
Intro to htmlIntro to html
Intro to html
anshuman rahi
 
Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab File
Kandarp Tiwari
 
Html Table
Html TableHtml Table
Html Table
nehashinde41
 
Introduction to Javascript By Satyen
Introduction to Javascript By  SatyenIntroduction to Javascript By  Satyen
Introduction to Javascript By Satyen
Satyen Pandya
 
HTML Dasar : #4 Paragraf
HTML Dasar : #4 ParagrafHTML Dasar : #4 Paragraf
HTML Dasar : #4 Paragraf
Sandhika Galih
 
CSS Dasar #1 : Intro
CSS Dasar #1 : IntroCSS Dasar #1 : Intro
CSS Dasar #1 : Intro
Sandhika Galih
 
CSS Dasar #9 : Inheritance
CSS Dasar #9 : InheritanceCSS Dasar #9 : Inheritance
CSS Dasar #9 : Inheritance
Sandhika Galih
 
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZerStd 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Nuzhat Memon
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
argusacademy
 
Html forms
Html formsHtml forms
Html forms
nobel mujuji
 
CSS Dasar #8 : Pseudo-class
CSS Dasar #8 : Pseudo-classCSS Dasar #8 : Pseudo-class
CSS Dasar #8 : Pseudo-class
Sandhika Galih
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
Michael Jhon
 

What's hot (20)

HTML Dasar : #10 Form
HTML Dasar : #10 FormHTML Dasar : #10 Form
HTML Dasar : #10 Form
 
HTML Dasar : #5 Heading
HTML Dasar : #5 HeadingHTML Dasar : #5 Heading
HTML Dasar : #5 Heading
 
HTML Dasar : #6 List
HTML Dasar : #6 ListHTML Dasar : #6 List
HTML Dasar : #6 List
 
Updated html programs
Updated html programsUpdated html programs
Updated html programs
 
UG Degree Certificate
UG Degree CertificateUG Degree Certificate
UG Degree Certificate
 
Introduction to HTML and CSS
Introduction to HTML and CSSIntroduction to HTML and CSS
Introduction to HTML and CSS
 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
 
Tema 6 - Formularios en html
Tema 6 - Formularios en htmlTema 6 - Formularios en html
Tema 6 - Formularios en html
 
Intro to html
Intro to htmlIntro to html
Intro to html
 
Web Technology Lab File
Web Technology Lab FileWeb Technology Lab File
Web Technology Lab File
 
Html Table
Html TableHtml Table
Html Table
 
Introduction to Javascript By Satyen
Introduction to Javascript By  SatyenIntroduction to Javascript By  Satyen
Introduction to Javascript By Satyen
 
HTML Dasar : #4 Paragraf
HTML Dasar : #4 ParagrafHTML Dasar : #4 Paragraf
HTML Dasar : #4 Paragraf
 
CSS Dasar #1 : Intro
CSS Dasar #1 : IntroCSS Dasar #1 : Intro
CSS Dasar #1 : Intro
 
CSS Dasar #9 : Inheritance
CSS Dasar #9 : InheritanceCSS Dasar #9 : Inheritance
CSS Dasar #9 : Inheritance
 
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZerStd 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
 
Html ordered & unordered list
Html ordered & unordered listHtml ordered & unordered list
Html ordered & unordered list
 
Html forms
Html formsHtml forms
Html forms
 
CSS Dasar #8 : Pseudo-class
CSS Dasar #8 : Pseudo-classCSS Dasar #8 : Pseudo-class
CSS Dasar #8 : Pseudo-class
 
Cascading style sheet
Cascading style sheetCascading style sheet
Cascading style sheet
 

Similar to Forms Part 1

Web forms and html (lect 4)
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)
Salman Memon
 
Html forms
Html formsHtml forms
Html forms
Himanshu Pathak
 
3. HTML Forms.ppt
3. HTML Forms.ppt3. HTML Forms.ppt
3. HTML Forms.ppt
MuhammadRehan856177
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
Steve Guinan
 
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
 
Creating web form(For College Seminars)
Creating web form(For College Seminars)Creating web form(For College Seminars)
Creating web form(For College Seminars)
Naman Joshi
 
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
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
gunjansingh599205
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
Saad Sheikh
 
Html forms
Html formsHtml forms
Html forms
eShikshak
 
Html Form Controls
Html Form ControlsHtml Form Controls
HTML Forms
HTML FormsHTML Forms
HTML Forms
Nisa Soomro
 
web-lab2 for computer science html tss css java
web-lab2 for computer science html tss css javaweb-lab2 for computer science html tss css java
web-lab2 for computer science html tss css java
shereifhany
 
Getting Information through HTML Forms
Getting Information through HTML FormsGetting Information through HTML Forms
Getting Information through HTML Forms
Mike Crabb
 
Chapter 2 class power point
Chapter 2 class power pointChapter 2 class power point
Chapter 2 class power point
cmurphysvhs
 
IT2255 Web Essentials - Unit II Web Designing
IT2255 Web Essentials - Unit II  Web DesigningIT2255 Web Essentials - Unit II  Web Designing
IT2255 Web Essentials - Unit II Web Designing
pkaviya
 

Similar to Forms Part 1 (20)

Web forms and html (lect 4)
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)
 
Html forms
Html formsHtml forms
Html forms
 
3. HTML Forms.ppt
3. HTML Forms.ppt3. HTML Forms.ppt
3. HTML Forms.ppt
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Creating web form(For College Seminars)
Creating web form(For College Seminars)Creating web form(For College Seminars)
Creating web form(For College Seminars)
 
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
 
Html4
Html4Html4
Html4
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
 
Html4
Html4Html4
Html4
 
Html forms
Html formsHtml forms
Html forms
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Html forms
Html formsHtml forms
Html forms
 
web-lab2 for computer science html tss css java
web-lab2 for computer science html tss css javaweb-lab2 for computer science html tss css java
web-lab2 for computer science html tss css java
 
Getting Information through HTML Forms
Getting Information through HTML FormsGetting Information through HTML Forms
Getting Information through HTML Forms
 
Html class-04
Html class-04Html class-04
Html class-04
 
Chapter 2 class power point
Chapter 2 class power pointChapter 2 class power point
Chapter 2 class power point
 
IT2255 Web Essentials - Unit II Web Designing
IT2255 Web Essentials - Unit II  Web DesigningIT2255 Web Essentials - Unit II  Web Designing
IT2255 Web Essentials - Unit II Web Designing
 

More from kjkleindorfer

Logic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing ApplicationsLogic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing Applications
kjkleindorfer
 
Week11 Inheritance class relationships in Java
Week11 Inheritance class relationships in JavaWeek11 Inheritance class relationships in Java
Week11 Inheritance class relationships in Java
kjkleindorfer
 
Week10 packages using objects in objects
Week10 packages using objects in objectsWeek10 packages using objects in objects
Week10 packages using objects in objects
kjkleindorfer
 
Week9 Intro to classes and objects in Java
Week9 Intro to classes and objects in JavaWeek9 Intro to classes and objects in Java
Week9 Intro to classes and objects in Java
kjkleindorfer
 
Intro to Bootstrap
Intro to BootstrapIntro to Bootstrap
Intro to Bootstrap
kjkleindorfer
 
Layouts Part 2
Layouts Part 2Layouts Part 2
Layouts Part 2
kjkleindorfer
 
Layouts
Layouts Layouts
Layouts
kjkleindorfer
 
Using PHP to submit forms
Using PHP to submit formsUsing PHP to submit forms
Using PHP to submit forms
kjkleindorfer
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
kjkleindorfer
 
CSS Selectors and Fonts
CSS Selectors and FontsCSS Selectors and Fonts
CSS Selectors and Fonts
kjkleindorfer
 

More from kjkleindorfer (10)

Logic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing ApplicationsLogic and Coding of Java Interfaces & Swing Applications
Logic and Coding of Java Interfaces & Swing Applications
 
Week11 Inheritance class relationships in Java
Week11 Inheritance class relationships in JavaWeek11 Inheritance class relationships in Java
Week11 Inheritance class relationships in Java
 
Week10 packages using objects in objects
Week10 packages using objects in objectsWeek10 packages using objects in objects
Week10 packages using objects in objects
 
Week9 Intro to classes and objects in Java
Week9 Intro to classes and objects in JavaWeek9 Intro to classes and objects in Java
Week9 Intro to classes and objects in Java
 
Intro to Bootstrap
Intro to BootstrapIntro to Bootstrap
Intro to Bootstrap
 
Layouts Part 2
Layouts Part 2Layouts Part 2
Layouts Part 2
 
Layouts
Layouts Layouts
Layouts
 
Using PHP to submit forms
Using PHP to submit formsUsing PHP to submit forms
Using PHP to submit forms
 
CSS Box Model
CSS Box ModelCSS Box Model
CSS Box Model
 
CSS Selectors and Fonts
CSS Selectors and FontsCSS Selectors and Fonts
CSS Selectors and Fonts
 

Recently uploaded

STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
kimdan468
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
ArianaBusciglio
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
Pavel ( NSTU)
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
thanhdowork
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
deeptiverma2406
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
EduSkills OECD
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
Jean Carlos Nunes Paixão
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
MysoreMuleSoftMeetup
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
Balvir Singh
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
Delapenabediema
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
Tamralipta Mahavidyalaya
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
Ashokrao Mane college of Pharmacy Peth-Vadgaon
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
TechSoup
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
timhan337
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
Atul Kumar Singh
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
gb193092
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Thiyagu K
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
JosvitaDsouza2
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
Jisc
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
DhatriParmar
 

Recently uploaded (20)

STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBCSTRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
STRAND 3 HYGIENIC PRACTICES.pptx GRADE 7 CBC
 
Group Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana BuscigliopptxGroup Presentation 2 Economics.Ariana Buscigliopptx
Group Presentation 2 Economics.Ariana Buscigliopptx
 
Synthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptxSynthetic Fiber Construction in lab .pptx
Synthetic Fiber Construction in lab .pptx
 
A Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptxA Survey of Techniques for Maximizing LLM Performance.pptx
A Survey of Techniques for Maximizing LLM Performance.pptx
 
Best Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDABest Digital Marketing Institute In NOIDA
Best Digital Marketing Institute In NOIDA
 
Francesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptxFrancesca Gottschalk - How can education support child empowerment.pptx
Francesca Gottschalk - How can education support child empowerment.pptx
 
Lapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdfLapbook sobre os Regimes Totalitários.pdf
Lapbook sobre os Regimes Totalitários.pdf
 
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
Mule 4.6 & Java 17 Upgrade | MuleSoft Mysore Meetup #46
 
Operation Blue Star - Saka Neela Tara
Operation Blue Star   -  Saka Neela TaraOperation Blue Star   -  Saka Neela Tara
Operation Blue Star - Saka Neela Tara
 
The Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official PublicationThe Challenger.pdf DNHS Official Publication
The Challenger.pdf DNHS Official Publication
 
Home assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdfHome assignment II on Spectroscopy 2024 Answers.pdf
Home assignment II on Spectroscopy 2024 Answers.pdf
 
Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.Biological Screening of Herbal Drugs in detailed.
Biological Screening of Herbal Drugs in detailed.
 
Introduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp NetworkIntroduction to AI for Nonprofits with Tapp Network
Introduction to AI for Nonprofits with Tapp Network
 
Honest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptxHonest Reviews of Tim Han LMA Course Program.pptx
Honest Reviews of Tim Han LMA Course Program.pptx
 
Language Across the Curriculm LAC B.Ed.
Language Across the  Curriculm LAC B.Ed.Language Across the  Curriculm LAC B.Ed.
Language Across the Curriculm LAC B.Ed.
 
Marketing internship report file for MBA
Marketing internship report file for MBAMarketing internship report file for MBA
Marketing internship report file for MBA
 
Unit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdfUnit 2- Research Aptitude (UGC NET Paper I).pdf
Unit 2- Research Aptitude (UGC NET Paper I).pdf
 
1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx1.4 modern child centered education - mahatma gandhi-2.pptx
1.4 modern child centered education - mahatma gandhi-2.pptx
 
Supporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptxSupporting (UKRI) OA monographs at Salford.pptx
Supporting (UKRI) OA monographs at Salford.pptx
 
The Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptxThe Accursed House by Émile Gaboriau.pptx
The Accursed House by Émile Gaboriau.pptx
 

Forms Part 1

  • 2. Data Collection and Processing • An HTML form is a collection of HTML elements used to gather data that a user enters online. • When a user clicks a form’s submit button to send the data, the form connects to a form handler—software that runs on a Web file server and processes the form.
  • 4. Creating a Form • Every form begins with the start <form> tag and ends with the closing </form> tag, which must be within the document <body></body> tags. • The <form> tag has several attributes and values, including a unique id for the form. • The action attribute in the <form> tag identifies the location on the server where you’ll send the data. • The method attribute tells the browser how to submit the form information.
  • 5. Creating a Form • A form can be created using the following code: <form id = "idvalue" method = "methodtype" action = "script_url"></form> where – idvalue is the name of the form – methodtype is either get or post – script_url is the location on the file server where the script will be run when the form is submitted
  • 6. The get and post Methods • The default get method sends the data in the form directly to the server by appending the data to the URL. • Using the post method, the browser contacts the server, and then the data in the form is sent to the server. • The post method is more secure than the get method.
  • 7. The text Element • The syntax for creating a text box is: <input type = "texttype" name = "name" id = "id" value = "initialvalue" size = "sizevalue" maxlength = "maxvalue" /> where – texttype is text, password, email, or any valid value – initialvalue is the default data that appears in the field – sizevalue is the width of the box in characters – maxvalue is the maximum number of characters that a user can type in the field
  • 8. The fieldset Element • To organize form elements using the fieldset and legend elements, the following code is used: <fieldset><legend>legendtext</legend> form elements </fieldset> where – legendtext is the text for the legend – form elements is the code for the form controls grouped together
  • 9. Form Container • The form container can be formatted in the same way the other HTML elements can be formatted.
  • 10. Styling the form and formcontainer Selectors
  • 11. Determining Input Types • A field represents a single kind of data. • A user enters data into each field in a form based on prompting text—a short description that suggests what data belongs in a certain field. • The label element is used to display prompting text on the screen. • The input element is used to determine the type of data a control collects.
  • 12. Determining Input Types • The label element is used together with the input element. – The label element uses the for attribute, which associates the label with the id value in the input element. <label for = “lastname”>Last Name</label> <input type = “text” name=“lastname” id=“lastname” /> • The type attribute determines the specific type of form object that is created: – text input – a check box – an option button – another form object.
  • 13. Creating Text Boxes • The text box control is used to gather alphanumeric data (letters or numbers) as a single line of text in a form. • Use the type attribute with a value of text to create a single-line text box. • Another type of single-line text field is a password field, where input is masked. • The type attribute value for the password field is password.
  • 15. Email Text Box • Another type of single-line text field is an email text box, where input is masked. • The type attribute value for the email text box is email. • The default length for the text boxes is 20 characters. • The size attribute is used to make the email text box longer.
  • 17. Setting a Value in a Text Box • The value attribute is used to set an initial value of a text box control. • The value of the value attribute appears in the text box when the Web page opens.
  • 18. Setting a Placeholder Value • Some Web browsers recognize the placeholder attribute and display its value in a light grey color. • The placeholder attribute allows you to display a sample email address in the input box.
  • 19. Creating Option Buttons • A radio button lets users make only a single choice from a group of options. • The input type for an option button is radio. • Each option button would appear to the right of each label. • The option buttons that form one group all have the same name attribute and value. • The value attribute is used by the program on the server when the form is submitted.
  • 20. Creating Option Buttons • To create option buttons, the following code is used for each one: <input type = "radio" name = "name" id = "id" value = "field_data" /> where – name identifies the corresponding field in the database – id associates the field with the for attribute in the label element – field_data is the data that will be sent to the appropriate field in the database if the button is selected • To specify that an option button is checked by default, add the attribute and value checked = "checked" to the <input> tag code.
  • 21. Option Buttons Example <fieldset> <legend>Personal Information</legend> <input type = "radio" name = "gender" id = "hungry" value = "hungry" checked = "checked" /> <label for = "hungry">Hungry</label> </fieldset>
  • 22. Creating Check Boxes • A check box is a form control that allows a user to choose none, one, or more than one item from a group. • The input type for a check box is checkbox. • A check box is named to correspond to the field name in the database that receives the data when a user selects that check box. • Each check box should have a different name attribute.
  • 23. Creating Check Boxes • The code for creating check boxes is: <input type = "checkbox" name = "name" id = "id" value = "data" /> where – name identifies the check box field with a field in the database – id associates the field with the for attribute in the label element – data is the data that will be sent to the database if the check box is selected • To specify that a check box is checked by default, add the attribute and value checked = "checked" to the tag.
  • 25. Creating a Selection List • A selection list is a form control that displays all the items in a list and allows a user to choose from the list. • A drop-down list box displays only one item in a selection list; the user clicks a list arrow to display the remaining contents of the list and to make a selection. • The select element is used to create a selection list.
  • 26. Creating a Selection List • The option element is used to define each menu choice within a selection list. • An option element’s value attribute and its value determine the data that is sent to the form handler. • The option text is the text that appears in the browser as a choice in the selection list.
  • 27. Creating a Selection List • The code for creating a selection list is: <select name = "name" id = "id"> <option value = "value1">optiontext1 </option> <option value = "value2">optiontext2 </option> … </select> where – name identifies a field in the database – id identifies the value for the for attribute in the label element – optiontext1 and optiontext2 are choices in the option list – value1 and value2 are the values sent to the program on the server when the form is submitted
  • 28. Creating a Selection List – Special Considerations • More than one item in the list to appear in the browser – use size = "number", where number is the number of items you want to display in the selection list. • Allow user to select more than one choice – use multiple = "multiple" in the <select> tag code. • Default choice – use selected = "selected" in the <option> tag code.
  • 30. Creating a Text Area • A text area is a control that allows users to enter more than one line of alphanumeric input. • The textarea element is used to create a multiline text field. • A text area allows users to enter comments that suggest how to improve a particular service or the form itself, or to provide other feedback.
  • 31. Creating a Text Area • The code for creating a text area is: <textarea name = "name" id = "id" rows = "height_value" cols = "width_value"></textarea> where – name identifies the field in the database associated with the text area – id associates this field with the for attribute value in the label element – height_value is the number of rows – width_value is the character width of the text area expressed as a number
  • 33. Submitting Data • A command button is a form control that lets a user execute or cancel an action. • A submit button is used to submit the form data to the specified action location. <input type = "submit" value = "buttontext" /> • A reset button clears or resets the form fields to the default values so the user can cancel the input in the form and start over. <input type = "reset" value = "buttontext" />
  • 34. Styling Submit and Reset Buttons