SlideShare a Scribd company logo
webDeV@rgu
getting information from users
html forms
quick tip…
THE “SECURITY HACK” AT THE END OFTHIS PRESENTATION IS SOMETHINGTHAT EVERYONE SHOULD KNOW!
• HTML Forms
• Form Presentation
• Form Elements
• Input Types
• Input Attributes
• Form Security
Overview
HTML
Forms
• Capturing user input
• registering user information
• entering username and password for login
• posting status updates to social networks
• submitting a search query
• taking a questionnaire
• Transmitting user input elsewhere
• send to client side JavaScript for validation
• send to server side process (PHP, Java,
JavaScript)
Purpose of html Forms
Form
Presentation
a simple html form
• The form tag contains all the input elements
• <form> … </form>
• Input elements can be of <input type=“” />
• Text/password/file or textarea
• Radio button or Checkbox
• Select boxes
• All input elements should be given a form label
• Improves accessibility if using a screen reader
• <label> … </label>
• Fieldsets can be used to graphically group input
elements together
• <fieldset> … </fieldset>
Basic form elements
<form>
<fieldset>
<legend>Please leave a comment...</legend>
<label for="name">Name:</label>
<input type="text" name="name" value="" />
<label for="email">Email:</label>
<input type="text" name="email" value="" />
<label for="comments">Comment:</label>
<textarea name="comments" cols="45“ rows="5">
</textarea>
<input type="submit" value="Submit" />
</fieldset>
</form>
• Best practice is to use CSS
• However, tables are still used a lot for layout of
form elements
• better than a messy form
Form Presentation
<form>
<fieldset>
<legend>Please leave a comment...</legend>
<label for="name">Name:</label>
<input type="text" name="name" value="" />
<br>
<label for="email">Email:</label>
<input type="text" name="email" value="" />
<br>
<label for="comments">Comment:</label>
<textarea name="comments" cols="45" rows="5"></textarea>
<br>
<input type="submit" value="Submit" />
</fieldset>
</form>
<style> input, textarea {width: 400px;} </style>
<form>
<fieldset>
<legend>Please leave a comment...</legend>
<table>
<tr>
<td><label>Name:</label></td>
<td><input type="text" name="name" value="" /></td>
</tr>
<tr>
<td><label>Email:</label></td>
<td><input type="text" name="email" value="" /></td>
</tr>
<tr>
<td><label>Comment:</label></td>
<td><textarea name="comments" cols="45" rows="5">
</textarea></td>
</tr>
<tr>
<td colspan=2><input type="submit" value="Submit" /></td>
</tr>
</table>
</fieldset>
</form>
Column 1 Column 2
Row 1
Row 2
Row 3
Row 4
Form Presentation
• Best practice is to use CSS
• However, tables are still used a lot for layout of
form elements
• better than a messy form
• Next week we will look at CSS in a lot more detail
so that you can get the hang of it.
Form
elements
input types
• Provides simple text input
text
<form>
<label for=“firstname>First name:</label><br>
<input type="text" name="firstname"><br>
Last name:<br>
<input type="text" name="lastname">
</form>
• Provides text input that is hidden from the user
password
<form>
User name:<br>
<input type="text" name="username"><br>
User password:<br>
<input type="password" name="psw">
</form>
<form action="action_page.php">
First name:<br>
<input type="text" name="firstname" value="Mike"><br>
Last name:<br>
<input type="text" name="lastname" value="Crabb"><br><br>
<input type="submit" value="Submit">
</form>
• Submit button for forms
submit
<form>
Birthday:
<input type="date" name="bday">
</form>
• The <input type="date"> is used for input fields that
should contain a date.
date
• Provides for a selection of zero or more items from
a list of options
checkboxes
<input type="checkbox" name="pets" value="loveCats">I love cats <br>

<input type="checkbox" name="pets" value="loveDogs">I love dogs

• Provides for only one selection from a list of options
Radio buttons
<input type="radio" name="cats" value="loveCats">I love cats <br>

<input type="radio" name="cats" value="hateCats">I have no soul
• Choose from a list of options
• use the <select> tag
• list <options>
Selection (drop down) Box
<label for="degreeTitle">Degree Title:</label>

<select name="degreeTitle">

<option value="cs">Computer Science</option>

<option value="dm">Digital Media</option>

<option value="cnmd">Computer Network Management and Design</option
</select>
• Provides for only one selection from a list of options
coloUr
<form>
Select your favorite color:
<input type="color" name="favcolor">
</form>
• Provides for only one selection from a list of options
email
<form>
E-mail:
<input type="email" name="email">
<input type="submit">
</form>
• Provides for only one selection from a list of options
URL
<form>
Add your homepage:
<input type="url" name="homepage">
</form>
HTML5 form improvements
email
url
Reset
color
check input is valid email address
(something@something.something)
check input is valid web address
(http://www.something.something)
Clears everything on the page
Select a colour
american spelling
Form
elements
input attributes
• The value attribute specifies the initial value for an
input field:
value
<form action="">
First name:<br>
<input type="text" name="firstname" value="John">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
• The readonly attribute specifies that the input field
is read only (cannot be changed)
read only
<form action="">
First name:<br>
<input type="text" name="firstname" value="John" readonly>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
• The disabled attribute specifies that the input field
is disabled.
• A disabled element is un-usable and un-clickable.
• Disabled elements will not be submitted
Disabled
<form action="">
First name:<br>
<input type="text" name="firstname" value="John" disabled>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
• The size attribute specifies the size (in characters)
for the input field
size
<form action="">
First name:<br>
<input type="text" name="firstname" value="John" size="40">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
• The maxlength attribute specifies the maximum
allowed length for the input field:
maxlength
<form action="">
First name:<br>
<input type="text" name="firstname" maxlength="10">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
• The autocomplete attribute specifies whether a
form or input field should have autocomplete on or
off
autocomplete
<form autocomplete="on">
First name:<input type="text" name="fname"><br>
Last name: <input type="text" name="lname"><br>
E-mail: <input type="email" name="email"
autocomplete="off"><br>
<input type="submit">
</form>
placeholder
• The placeholder attribute specifies a hint that
describes the expected value of an input field (a
sample value or a short description of the format).
<input type="text" name="fname" placeholder="First name">
required
• When present, it specifies that an input field must
be filled out before submitting the form.
• The required attribute works with the following
input types: text, search, url, tel, email, password,
date pickers, number, checkbox, radio, and file.
Username: <input type="text" name="username" required>
This one is
important
form
security
form security
• Forms can be quite insecure when we are using
them, we need to make sure that the right data
is being seen by the right people
• and that no-one can get access to the
really sensitive data!
For example…here’s how to find our a password on
an unsecured computer
PS - DON’T DO THIS ONE SOMEONE ELSES
COMPUTER - YOU’ll GET INTO A LOT OF TROUBLE!!
I’ve visited a website and have put in my
username and password into the box
provided. Let’s say that now I have to step
away from my computer for 5 seconds…
Some unsavoury character comes along
and looks at my screen. They right click on
the password field and then go to inspect, I
wonder what they are up to?
Now they are looking at the HTML for this
web page and have an interest in the field
that my password is in. It’s ok…its secure
(it really isn’t).
They change the form element from:
<input type=“Password”>
to
<Input Type=“text”>
and now my password is being shown to the
world #awkward!
• HTML Forms
• Form Presentation
• Form Elements
• Input Types
• Input Attributes
• Form Security
Recap
get in touch!
@mike_crabb
Lecturer in Web Development at Robert Gordon University
(Scotland)
@rgucomputing
Robert Gordon University - School of Computing Science and
Digital Media

More Related Content

What's hot (20)

PDF
What is Social Media?
Martafy!
 
PDF
2016 Digital predictions for marketing, tech, pop culture and everything in b...
Soap Creative
 
PDF
31+ Startup Tools, Both Online & Offline
Pixc
 
PPT
1. introduction to html5
JayjZens
 
PPTX
Microsoft SharePoint
Umar Farooq
 
ODP
100 growth hacks 100 days | 1 to 10
Robin Yjord
 
PDF
Montreal Girl Geeks: Building the Modern Web
Rachel Andrew
 
PPTX
e-Commerce Website Development Proposal
Indicsoft Technologies
 
PPTX
HTML-(workshop)7557.pptx
Raja980775
 
PDF
Kids computer-programming
Edward Burns
 
ODP
Relationships in Salesforce
MST Solutions LLC
 
PDF
Lecture-3: Introduction to html - Basic Structure & Block Building
Mubashir Ali
 
PPTX
Introduction to html course digital markerters
SEO SKills
 
PPTX
A Short History of the Metaverse
Bernard Marr
 
PPTX
Html accessibility
Dhananjay Bhole
 
PDF
AN OVERVIEW OF THE METAVERSE
Happiest Minds Technologies
 
PDF
Introduction to WordPress
LumosTech
 
PDF
Up to Speed on HTML 5 and CSS 3
M. Jackson Wilkinson
 
PDF
WEB I - 01 - Introduction to Web Development
Randy Connolly
 
PPTX
Java script
Sadeek Mohammed
 
What is Social Media?
Martafy!
 
2016 Digital predictions for marketing, tech, pop culture and everything in b...
Soap Creative
 
31+ Startup Tools, Both Online & Offline
Pixc
 
1. introduction to html5
JayjZens
 
Microsoft SharePoint
Umar Farooq
 
100 growth hacks 100 days | 1 to 10
Robin Yjord
 
Montreal Girl Geeks: Building the Modern Web
Rachel Andrew
 
e-Commerce Website Development Proposal
Indicsoft Technologies
 
HTML-(workshop)7557.pptx
Raja980775
 
Kids computer-programming
Edward Burns
 
Relationships in Salesforce
MST Solutions LLC
 
Lecture-3: Introduction to html - Basic Structure & Block Building
Mubashir Ali
 
Introduction to html course digital markerters
SEO SKills
 
A Short History of the Metaverse
Bernard Marr
 
Html accessibility
Dhananjay Bhole
 
AN OVERVIEW OF THE METAVERSE
Happiest Minds Technologies
 
Introduction to WordPress
LumosTech
 
Up to Speed on HTML 5 and CSS 3
M. Jackson Wilkinson
 
WEB I - 01 - Introduction to Web Development
Randy Connolly
 
Java script
Sadeek Mohammed
 

Viewers also liked (20)

PDF
DESIGN THE PRIORITY, PERFORMANCE 
AND UX
Peter Rozek
 
PDF
Internet of Things - The Tip of an Iceberg
Dr. Mazlan Abbas
 
PDF
Introduction to Development for the Internet
Mike Crabb
 
PDF
Node.js and The Internet of Things
Losant
 
PDF
Finding Our Happy Place in the Internet of Things
Pamela Pavliscak
 
PDF
Build Features, Not Apps
Natasha Murashev
 
PDF
Valentine's Day
Ingenico ePayments
 
PDF
Health and Well-Being on the Social Web
ron mader
 
PDF
How Much Further Will Internet Stocks Fall? (Share Price Performance)
Mahesh Vellanki
 
PDF
Net neutrality: The Basics
InterQuest Group
 
PDF
Visual Design with Data
Seth Familian
 
PPTX
25 Festive Fonts For Women Oriented Businesses!
DesignMantic
 
PDF
Digital in 2016
We Are Social Singapore
 
PDF
Designing Teams for Emerging Challenges
Aaron Irizarry
 
PDF
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
 
PDF
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís
 
PDF
Mobile Is Eating the World (2016)
a16z
 
PDF
UX, ethnography and possibilities: for Libraries, Museums and Archives
Ned Potter
 
PPTX
IT in Healthcare
NetApp
 
PDF
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
DESIGN THE PRIORITY, PERFORMANCE 
AND UX
Peter Rozek
 
Internet of Things - The Tip of an Iceberg
Dr. Mazlan Abbas
 
Introduction to Development for the Internet
Mike Crabb
 
Node.js and The Internet of Things
Losant
 
Finding Our Happy Place in the Internet of Things
Pamela Pavliscak
 
Build Features, Not Apps
Natasha Murashev
 
Valentine's Day
Ingenico ePayments
 
Health and Well-Being on the Social Web
ron mader
 
How Much Further Will Internet Stocks Fall? (Share Price Performance)
Mahesh Vellanki
 
Net neutrality: The Basics
InterQuest Group
 
Visual Design with Data
Seth Familian
 
25 Festive Fonts For Women Oriented Businesses!
DesignMantic
 
Digital in 2016
We Are Social Singapore
 
Designing Teams for Emerging Challenges
Aaron Irizarry
 
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn
 
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís
 
Mobile Is Eating the World (2016)
a16z
 
UX, ethnography and possibilities: for Libraries, Museums and Archives
Ned Potter
 
IT in Healthcare
NetApp
 
How to Become a Thought Leader in Your Niche
Leslie Samuel
 
Ad

Similar to Getting Information through HTML Forms (20)

PPT
Forms,Frames.ppt
MaheShiva
 
PPT
Forms,Frames.ppt
MaheShiva
 
PPTX
Html form tag
shreyachougule
 
PPTX
HTML FORMS.pptx
Sierranaijamusic
 
PPTX
Html forms
nobel mujuji
 
PPT
Web-page develepment for computer engineers.ppt
KemalHussen
 
PPTX
Html tables, forms and audio video
Saad Sheikh
 
PDF
CSS_Forms.pdf
gunjansingh599205
 
PPTX
unit2_HTML_Forms fundamentals of html and crore concepts.pptx
22247019
 
PPT
Web forms and html (lect 4)
Salman Memon
 
PPT
Html forms
M Vishnuvardhan Reddy
 
PPTX
Forms.pptx
venugopalcharry1921
 
PPTX
HYPERTEXT MARK UP LANGUAGES (HTML) FORMS
RoselAAliganga
 
PPTX
Web design - Working with forms in HTML
Mustafa Kamel Mohammadi
 
PPTX
Web engineering - HTML Form
Nosheen Qamar
 
PPTX
1. Lecture 1 WT- Forms.pptxl;kjhgfdsfghj
tavgaqasim8
 
PPT
Html class-04
Md Ali Hossain
 
PPTX
Html forms
Himanshu Pathak
 
PPTX
Html forms
Er. Nawaraj Bhandari
 
PPT
Chapter9
DeAnna Gossett
 
Forms,Frames.ppt
MaheShiva
 
Forms,Frames.ppt
MaheShiva
 
Html form tag
shreyachougule
 
HTML FORMS.pptx
Sierranaijamusic
 
Html forms
nobel mujuji
 
Web-page develepment for computer engineers.ppt
KemalHussen
 
Html tables, forms and audio video
Saad Sheikh
 
CSS_Forms.pdf
gunjansingh599205
 
unit2_HTML_Forms fundamentals of html and crore concepts.pptx
22247019
 
Web forms and html (lect 4)
Salman Memon
 
HYPERTEXT MARK UP LANGUAGES (HTML) FORMS
RoselAAliganga
 
Web design - Working with forms in HTML
Mustafa Kamel Mohammadi
 
Web engineering - HTML Form
Nosheen Qamar
 
1. Lecture 1 WT- Forms.pptxl;kjhgfdsfghj
tavgaqasim8
 
Html class-04
Md Ali Hossain
 
Html forms
Himanshu Pathak
 
Chapter9
DeAnna Gossett
 
Ad

More from Mike Crabb (20)

PDF
Hard to Reach Users in Easy to Reach Places
Mike Crabb
 
PDF
Accessible and Assistive Interfaces
Mike Crabb
 
PDF
Accessible Everyone
Mike Crabb
 
PDF
The Peer Review Process
Mike Crabb
 
PDF
Managing Quality In Qualitative Research
Mike Crabb
 
PDF
Analysing Qualitative Data
Mike Crabb
 
PDF
Conversation Discourse and Document Analysis
Mike Crabb
 
PDF
Ethnographic and Observational Research
Mike Crabb
 
PDF
Doing Focus Groups
Mike Crabb
 
PDF
Doing Interviews
Mike Crabb
 
PDF
Designing Qualitative Research
Mike Crabb
 
PDF
Introduction to Accessible Design
Mike Crabb
 
PDF
Accessible Everyone
Mike Crabb
 
PDF
Texture and Glyph Design
Mike Crabb
 
PDF
Pattern Perception and Map Design
Mike Crabb
 
PDF
Dealing with Enterprise Level Data
Mike Crabb
 
PDF
Using Cloud in an Enterprise Environment
Mike Crabb
 
PDF
Teaching Cloud to the Programmers of Tomorrow
Mike Crabb
 
PDF
Sql Injection and XSS
Mike Crabb
 
PDF
Forms and Databases in PHP
Mike Crabb
 
Hard to Reach Users in Easy to Reach Places
Mike Crabb
 
Accessible and Assistive Interfaces
Mike Crabb
 
Accessible Everyone
Mike Crabb
 
The Peer Review Process
Mike Crabb
 
Managing Quality In Qualitative Research
Mike Crabb
 
Analysing Qualitative Data
Mike Crabb
 
Conversation Discourse and Document Analysis
Mike Crabb
 
Ethnographic and Observational Research
Mike Crabb
 
Doing Focus Groups
Mike Crabb
 
Doing Interviews
Mike Crabb
 
Designing Qualitative Research
Mike Crabb
 
Introduction to Accessible Design
Mike Crabb
 
Accessible Everyone
Mike Crabb
 
Texture and Glyph Design
Mike Crabb
 
Pattern Perception and Map Design
Mike Crabb
 
Dealing with Enterprise Level Data
Mike Crabb
 
Using Cloud in an Enterprise Environment
Mike Crabb
 
Teaching Cloud to the Programmers of Tomorrow
Mike Crabb
 
Sql Injection and XSS
Mike Crabb
 
Forms and Databases in PHP
Mike Crabb
 

Recently uploaded (20)

PDF
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
PPTX
(2) Cell Wall Inhibitors_Cephalosporins others.pptx
mkurdi133
 
PPTX
BMC S6 M3 P1 building mATERIALS AND CONSTRUCTION.pptx
RizwanAlavi
 
PPTX
High-Rise Interior Mastery by Top 3D Visualization Experts
Yantram Animation Studio Corporation
 
PDF
Presentation - Interior Design Concepts (2).pdf
vrindagrawal456
 
PDF
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
DOCX
Ai vehicle traffic signal detector research proposal.docx
DavidNameza
 
DOCX
Ai Vehicle traffic signal detector Literature Review.
DavidNameza
 
PPTX
Town planning is a concept used in architectural design. It plays a very impo...
IshikaPanchal11
 
PDF
🔴BUKTI KEMENANGAN HARI INI SELASA 08 JULI 2025 !!!🔴
GRAB
 
PPTX
Visit Biogas Refresher Slide_Jun 2025.pptx
isyraffemir
 
PPTX
Adjective..pptxujjjjjjjjjjjjjjjjjjjjjjjj
seemanodiyal
 
DOCX
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
PPTX
feminist gnsudnshxujenduxhsixisjxuu.pptx
rowvinafujimoto
 
PPTX
Transportation in the air, sea and land.pptx
KhloodAli5
 
PPTX
the very teaching plan extra ordinary.pptx
PamelaOdibeli1
 
PDF
cs603 ppts .pdf 222222222222222222222222
RabiaNazneen1
 
PPT
Origin of the solar system acording .ppt
ReignLachica
 
PPTX
Types of post tensioning methods (2).pptx
RizwanAlavi
 
PPTX
619813902-Fun-friday-Identify-Bollywood-movie-from-dialogues-deliver-the-dial...
in4withme
 
PHILGOV-QUIZ-_20250625_182551_000.pdfhehe
errollnas3
 
(2) Cell Wall Inhibitors_Cephalosporins others.pptx
mkurdi133
 
BMC S6 M3 P1 building mATERIALS AND CONSTRUCTION.pptx
RizwanAlavi
 
High-Rise Interior Mastery by Top 3D Visualization Experts
Yantram Animation Studio Corporation
 
Presentation - Interior Design Concepts (2).pdf
vrindagrawal456
 
CRAC- Adobe Photoshop CC 2016 (32 64Bit) Crack
utfefguu
 
Ai vehicle traffic signal detector research proposal.docx
DavidNameza
 
Ai Vehicle traffic signal detector Literature Review.
DavidNameza
 
Town planning is a concept used in architectural design. It plays a very impo...
IshikaPanchal11
 
🔴BUKTI KEMENANGAN HARI INI SELASA 08 JULI 2025 !!!🔴
GRAB
 
Visit Biogas Refresher Slide_Jun 2025.pptx
isyraffemir
 
Adjective..pptxujjjjjjjjjjjjjjjjjjjjjjjj
seemanodiyal
 
Redefining Master Plans for creating sustainable cities-Jharkhand Conference...
JIT KUMAR GUPTA
 
feminist gnsudnshxujenduxhsixisjxuu.pptx
rowvinafujimoto
 
Transportation in the air, sea and land.pptx
KhloodAli5
 
the very teaching plan extra ordinary.pptx
PamelaOdibeli1
 
cs603 ppts .pdf 222222222222222222222222
RabiaNazneen1
 
Origin of the solar system acording .ppt
ReignLachica
 
Types of post tensioning methods (2).pptx
RizwanAlavi
 
619813902-Fun-friday-Identify-Bollywood-movie-from-dialogues-deliver-the-dial...
in4withme
 

Getting Information through HTML Forms

  • 1. webDeV@rgu getting information from users html forms quick tip… THE “SECURITY HACK” AT THE END OFTHIS PRESENTATION IS SOMETHINGTHAT EVERYONE SHOULD KNOW!
  • 2. • HTML Forms • Form Presentation • Form Elements • Input Types • Input Attributes • Form Security Overview
  • 4. • Capturing user input • registering user information • entering username and password for login • posting status updates to social networks • submitting a search query • taking a questionnaire • Transmitting user input elsewhere • send to client side JavaScript for validation • send to server side process (PHP, Java, JavaScript) Purpose of html Forms
  • 7. • The form tag contains all the input elements • <form> … </form> • Input elements can be of <input type=“” /> • Text/password/file or textarea • Radio button or Checkbox • Select boxes • All input elements should be given a form label • Improves accessibility if using a screen reader • <label> … </label> • Fieldsets can be used to graphically group input elements together • <fieldset> … </fieldset> Basic form elements
  • 8. <form> <fieldset> <legend>Please leave a comment...</legend> <label for="name">Name:</label> <input type="text" name="name" value="" /> <label for="email">Email:</label> <input type="text" name="email" value="" /> <label for="comments">Comment:</label> <textarea name="comments" cols="45“ rows="5"> </textarea> <input type="submit" value="Submit" /> </fieldset> </form>
  • 9. • Best practice is to use CSS • However, tables are still used a lot for layout of form elements • better than a messy form Form Presentation
  • 10. <form> <fieldset> <legend>Please leave a comment...</legend> <label for="name">Name:</label> <input type="text" name="name" value="" /> <br> <label for="email">Email:</label> <input type="text" name="email" value="" /> <br> <label for="comments">Comment:</label> <textarea name="comments" cols="45" rows="5"></textarea> <br> <input type="submit" value="Submit" /> </fieldset> </form>
  • 11. <style> input, textarea {width: 400px;} </style> <form> <fieldset> <legend>Please leave a comment...</legend> <table> <tr> <td><label>Name:</label></td> <td><input type="text" name="name" value="" /></td> </tr> <tr> <td><label>Email:</label></td> <td><input type="text" name="email" value="" /></td> </tr> <tr> <td><label>Comment:</label></td> <td><textarea name="comments" cols="45" rows="5"> </textarea></td> </tr> <tr> <td colspan=2><input type="submit" value="Submit" /></td> </tr> </table> </fieldset> </form>
  • 12. Column 1 Column 2 Row 1 Row 2 Row 3 Row 4
  • 13. Form Presentation • Best practice is to use CSS • However, tables are still used a lot for layout of form elements • better than a messy form • Next week we will look at CSS in a lot more detail so that you can get the hang of it.
  • 15. • Provides simple text input text <form> <label for=“firstname>First name:</label><br> <input type="text" name="firstname"><br> Last name:<br> <input type="text" name="lastname"> </form>
  • 16. • Provides text input that is hidden from the user password <form> User name:<br> <input type="text" name="username"><br> User password:<br> <input type="password" name="psw"> </form>
  • 17. <form action="action_page.php"> First name:<br> <input type="text" name="firstname" value="Mike"><br> Last name:<br> <input type="text" name="lastname" value="Crabb"><br><br> <input type="submit" value="Submit"> </form> • Submit button for forms submit
  • 18. <form> Birthday: <input type="date" name="bday"> </form> • The <input type="date"> is used for input fields that should contain a date. date
  • 19. • Provides for a selection of zero or more items from a list of options checkboxes <input type="checkbox" name="pets" value="loveCats">I love cats <br>
 <input type="checkbox" name="pets" value="loveDogs">I love dogs

  • 20. • Provides for only one selection from a list of options Radio buttons <input type="radio" name="cats" value="loveCats">I love cats <br>
 <input type="radio" name="cats" value="hateCats">I have no soul
  • 21. • Choose from a list of options • use the <select> tag • list <options> Selection (drop down) Box <label for="degreeTitle">Degree Title:</label>
 <select name="degreeTitle">
 <option value="cs">Computer Science</option>
 <option value="dm">Digital Media</option>
 <option value="cnmd">Computer Network Management and Design</option </select>
  • 22. • Provides for only one selection from a list of options coloUr <form> Select your favorite color: <input type="color" name="favcolor"> </form>
  • 23. • Provides for only one selection from a list of options email <form> E-mail: <input type="email" name="email"> <input type="submit"> </form>
  • 24. • Provides for only one selection from a list of options URL <form> Add your homepage: <input type="url" name="homepage"> </form>
  • 25. HTML5 form improvements email url Reset color check input is valid email address ([email protected]) check input is valid web address (http://www.something.something) Clears everything on the page Select a colour american spelling
  • 27. • The value attribute specifies the initial value for an input field: value <form action=""> First name:<br> <input type="text" name="firstname" value="John"> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 28. • The readonly attribute specifies that the input field is read only (cannot be changed) read only <form action=""> First name:<br> <input type="text" name="firstname" value="John" readonly> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 29. • The disabled attribute specifies that the input field is disabled. • A disabled element is un-usable and un-clickable. • Disabled elements will not be submitted Disabled <form action=""> First name:<br> <input type="text" name="firstname" value="John" disabled> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 30. • The size attribute specifies the size (in characters) for the input field size <form action=""> First name:<br> <input type="text" name="firstname" value="John" size="40"> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 31. • The maxlength attribute specifies the maximum allowed length for the input field: maxlength <form action=""> First name:<br> <input type="text" name="firstname" maxlength="10"> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 32. • The autocomplete attribute specifies whether a form or input field should have autocomplete on or off autocomplete <form autocomplete="on"> First name:<input type="text" name="fname"><br> Last name: <input type="text" name="lname"><br> E-mail: <input type="email" name="email" autocomplete="off"><br> <input type="submit"> </form>
  • 33. placeholder • The placeholder attribute specifies a hint that describes the expected value of an input field (a sample value or a short description of the format). <input type="text" name="fname" placeholder="First name">
  • 34. required • When present, it specifies that an input field must be filled out before submitting the form. • The required attribute works with the following input types: text, search, url, tel, email, password, date pickers, number, checkbox, radio, and file. Username: <input type="text" name="username" required> This one is important
  • 36. form security • Forms can be quite insecure when we are using them, we need to make sure that the right data is being seen by the right people • and that no-one can get access to the really sensitive data! For example…here’s how to find our a password on an unsecured computer PS - DON’T DO THIS ONE SOMEONE ELSES COMPUTER - YOU’ll GET INTO A LOT OF TROUBLE!!
  • 37. I’ve visited a website and have put in my username and password into the box provided. Let’s say that now I have to step away from my computer for 5 seconds…
  • 38. Some unsavoury character comes along and looks at my screen. They right click on the password field and then go to inspect, I wonder what they are up to?
  • 39. Now they are looking at the HTML for this web page and have an interest in the field that my password is in. It’s ok…its secure (it really isn’t).
  • 40. They change the form element from: <input type=“Password”> to <Input Type=“text”> and now my password is being shown to the world #awkward!
  • 41. • HTML Forms • Form Presentation • Form Elements • Input Types • Input Attributes • Form Security Recap
  • 42. get in touch! @mike_crabb Lecturer in Web Development at Robert Gordon University (Scotland) @rgucomputing Robert Gordon University - School of Computing Science and Digital Media