Getting Information through HTML Forms

Mike Crabb
Mike CrabbLecturer at University of Dundee à University of Dundee
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
1 sur 42

Recommandé

UX Metrics for Enterprise par
UX Metrics for EnterpriseUX Metrics for Enterprise
UX Metrics for EnterpriseNoemie PRIN
194 vues37 diapositives
How to Determine the ROI of Anything par
How to Determine the ROI of AnythingHow to Determine the ROI of Anything
How to Determine the ROI of AnythingGary Vaynerchuk
735.8K vues39 diapositives
Assessing friction in complex user journeys - the User Experience Index.pdf par
Assessing friction in complex user journeys - the User Experience Index.pdfAssessing friction in complex user journeys - the User Experience Index.pdf
Assessing friction in complex user journeys - the User Experience Index.pdfDannyHager1
120 vues69 diapositives
DESIGN THE PRIORITY, PERFORMANCE 
AND UX par
DESIGN THE PRIORITY, PERFORMANCE 
AND UXDESIGN THE PRIORITY, PERFORMANCE 
AND UX
DESIGN THE PRIORITY, PERFORMANCE 
AND UXPeter Rozek
25.2K vues76 diapositives
The Science of Story: How Brands Can Use Storytelling To Get More Customers par
The Science of Story: How Brands Can Use Storytelling To Get More CustomersThe Science of Story: How Brands Can Use Storytelling To Get More Customers
The Science of Story: How Brands Can Use Storytelling To Get More CustomersDigital Surgeons
6.7K vues55 diapositives
Montreal Girl Geeks: Building the Modern Web par
Montreal Girl Geeks: Building the Modern WebMontreal Girl Geeks: Building the Modern Web
Montreal Girl Geeks: Building the Modern WebRachel Andrew
254K vues124 diapositives

Contenu connexe

Tendances

Typography for [Digital] Humanists par
Typography for [Digital] HumanistsTypography for [Digital] Humanists
Typography for [Digital] HumanistsAmy Papaelias
47.7K vues37 diapositives
The Rise of Social Media Video Marketing par
The Rise of Social Media Video MarketingThe Rise of Social Media Video Marketing
The Rise of Social Media Video MarketingGary Vaynerchuk
302.3K vues78 diapositives
Forgotten women in tech history. par
Forgotten women in tech history.Forgotten women in tech history.
Forgotten women in tech history.Domo
144.4K vues12 diapositives
100 growth hacks 100 days | 1 to 10 par
100 growth hacks 100 days | 1 to 10100 growth hacks 100 days | 1 to 10
100 growth hacks 100 days | 1 to 10Robin Yjord
1.1M vues44 diapositives
How to Teach UX Design par
How to Teach UX DesignHow to Teach UX Design
How to Teach UX DesignChristina Wodtke
103.4K vues50 diapositives
What is UX? par
What is UX?What is UX?
What is UX?Peter van Lanschot
3.8K vues60 diapositives

Tendances(20)

Typography for [Digital] Humanists par Amy Papaelias
Typography for [Digital] HumanistsTypography for [Digital] Humanists
Typography for [Digital] Humanists
Amy Papaelias47.7K vues
The Rise of Social Media Video Marketing par Gary Vaynerchuk
The Rise of Social Media Video MarketingThe Rise of Social Media Video Marketing
The Rise of Social Media Video Marketing
Gary Vaynerchuk302.3K vues
Forgotten women in tech history. par Domo
Forgotten women in tech history.Forgotten women in tech history.
Forgotten women in tech history.
Domo144.4K vues
100 growth hacks 100 days | 1 to 10 par Robin Yjord
100 growth hacks 100 days | 1 to 10100 growth hacks 100 days | 1 to 10
100 growth hacks 100 days | 1 to 10
Robin Yjord1.1M vues
Talent Imitates, Genius Steals: Four Chapters on Being Creative in the Digita... par edward boches
Talent Imitates, Genius Steals: Four Chapters on Being Creative in the Digita...Talent Imitates, Genius Steals: Four Chapters on Being Creative in the Digita...
Talent Imitates, Genius Steals: Four Chapters on Being Creative in the Digita...
edward boches37.8K vues
10 Best Practices of a Best Company to Work For par O.C. Tanner
10 Best Practices of a Best Company to Work For10 Best Practices of a Best Company to Work For
10 Best Practices of a Best Company to Work For
O.C. Tanner1.2M vues
Five Apps You Should Download Today par Gary Vaynerchuk
Five Apps You Should Download TodayFive Apps You Should Download Today
Five Apps You Should Download Today
Gary Vaynerchuk211.2K vues
Integrating Social Media in your business model par Pieter Baert
Integrating Social Media in your business modelIntegrating Social Media in your business model
Integrating Social Media in your business model
Pieter Baert116.4K vues
Inspired Storytelling: Engaging People & Moving Them To Action par Kelsey Ruger
Inspired Storytelling: Engaging People & Moving Them To ActionInspired Storytelling: Engaging People & Moving Them To Action
Inspired Storytelling: Engaging People & Moving Them To Action
Kelsey Ruger71.4K vues
User Interfaces beyond the screen par Jason Mesut
User Interfaces beyond the screenUser Interfaces beyond the screen
User Interfaces beyond the screen
Jason Mesut131.9K vues
Driving Value Creation with A/B Testing & OKR par Product School
Driving Value Creation with A/B Testing & OKRDriving Value Creation with A/B Testing & OKR
Driving Value Creation with A/B Testing & OKR
Product School934 vues
Good Design Principles for App Developer (UAB) 2017 par Marçal P.
Good Design Principles for App Developer (UAB) 2017Good Design Principles for App Developer (UAB) 2017
Good Design Principles for App Developer (UAB) 2017
Marçal P.6.4K vues
Startup Metrics, a love story. All slides of an 6h Lean Analytics workshop. par Andreas Klinger
Startup Metrics, a love story. All slides of an 6h Lean Analytics workshop.Startup Metrics, a love story. All slides of an 6h Lean Analytics workshop.
Startup Metrics, a love story. All slides of an 6h Lean Analytics workshop.
Andreas Klinger324K vues
What 33 Successful Entrepreneurs Learned From Failure par ReferralCandy
What 33 Successful Entrepreneurs Learned From FailureWhat 33 Successful Entrepreneurs Learned From Failure
What 33 Successful Entrepreneurs Learned From Failure
ReferralCandy3.9M vues
Getting into the tech field. what next par Tessa Mero
Getting into the tech field. what next Getting into the tech field. what next
Getting into the tech field. what next
Tessa Mero6K vues

En vedette

Internet of Things - The Tip of an Iceberg par
Internet of Things - The Tip of an IcebergInternet of Things - The Tip of an Iceberg
Internet of Things - The Tip of an IcebergDr. Mazlan Abbas
50.5K vues86 diapositives
Introduction to Development for the Internet par
Introduction to Development for the InternetIntroduction to Development for the Internet
Introduction to Development for the InternetMike Crabb
101.6K vues22 diapositives
Node.js and The Internet of Things par
Node.js and The Internet of ThingsNode.js and The Internet of Things
Node.js and The Internet of ThingsLosant
142.7K vues31 diapositives
Finding Our Happy Place in the Internet of Things par
Finding Our Happy Place in the Internet of ThingsFinding Our Happy Place in the Internet of Things
Finding Our Happy Place in the Internet of ThingsPamela Pavliscak
74.6K vues42 diapositives
Build Features, Not Apps par
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not AppsNatasha Murashev
389K vues60 diapositives
Valentine's Day par
Valentine's DayValentine's Day
Valentine's DayIngenico ePayments
53.1K vues1 diapositive

En vedette(20)

Internet of Things - The Tip of an Iceberg par Dr. Mazlan Abbas
Internet of Things - The Tip of an IcebergInternet of Things - The Tip of an Iceberg
Internet of Things - The Tip of an Iceberg
Dr. Mazlan Abbas50.5K vues
Introduction to Development for the Internet par Mike Crabb
Introduction to Development for the InternetIntroduction to Development for the Internet
Introduction to Development for the Internet
Mike Crabb101.6K vues
Node.js and The Internet of Things par Losant
Node.js and The Internet of ThingsNode.js and The Internet of Things
Node.js and The Internet of Things
Losant142.7K vues
Finding Our Happy Place in the Internet of Things par Pamela Pavliscak
Finding Our Happy Place in the Internet of ThingsFinding Our Happy Place in the Internet of Things
Finding Our Happy Place in the Internet of Things
Pamela Pavliscak74.6K vues
Health and Well-Being on the Social Web par ron mader
Health and Well-Being on the Social WebHealth and Well-Being on the Social Web
Health and Well-Being on the Social Web
ron mader18.7K vues
How Much Further Will Internet Stocks Fall? (Share Price Performance) par Mahesh Vellanki
How Much Further Will Internet Stocks Fall? (Share Price Performance)How Much Further Will Internet Stocks Fall? (Share Price Performance)
How Much Further Will Internet Stocks Fall? (Share Price Performance)
Mahesh Vellanki28.5K vues
25 Festive Fonts For Women Oriented Businesses! par DesignMantic
25 Festive Fonts For Women Oriented Businesses!25 Festive Fonts For Women Oriented Businesses!
25 Festive Fonts For Women Oriented Businesses!
DesignMantic29.9K vues
Designing Teams for Emerging Challenges par Aaron Irizarry
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging Challenges
Aaron Irizarry1.1M vues
Study: The Future of VR, AR and Self-Driving Cars par LinkedIn
Study: The Future of VR, AR and Self-Driving CarsStudy: The Future of VR, AR and Self-Driving Cars
Study: The Future of VR, AR and Self-Driving Cars
LinkedIn870.2K vues
Mobile-First SEO - The Marketers Edition #3XEDigital par Aleyda Solís
Mobile-First SEO - The Marketers Edition #3XEDigitalMobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigital
Aleyda Solís471.4K vues
Mobile Is Eating the World (2016) par a16z
Mobile Is Eating the World (2016)Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)
a16z1.7M vues
UX, ethnography and possibilities: for Libraries, Museums and Archives par Ned Potter
UX, ethnography and possibilities: for Libraries, Museums and ArchivesUX, ethnography and possibilities: for Libraries, Museums and Archives
UX, ethnography and possibilities: for Libraries, Museums and Archives
Ned Potter1M vues
IT in Healthcare par NetApp
IT in HealthcareIT in Healthcare
IT in Healthcare
NetApp69.5K vues
How to Become a Thought Leader in Your Niche par Leslie Samuel
How to Become a Thought Leader in Your NicheHow to Become a Thought Leader in Your Niche
How to Become a Thought Leader in Your Niche
Leslie Samuel1.6M vues
3 Things Every Sales Team Needs to Be Thinking About in 2017 par Drift
3 Things Every Sales Team Needs to Be Thinking About in 20173 Things Every Sales Team Needs to Be Thinking About in 2017
3 Things Every Sales Team Needs to Be Thinking About in 2017
Drift492.7K vues

Similaire à Getting Information through HTML Forms

Html tables, forms and audio video par
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio videoSaad Sheikh
1.4K vues41 diapositives
Web forms and html (lect 4) par
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)Salman Memon
232 vues17 diapositives
Form using html and java script validation par
Form using html and java script validationForm using html and java script validation
Form using html and java script validationMaitree Patel
1.4K vues30 diapositives
Forms par
FormsForms
Formsmyrajendra
825 vues8 diapositives
Html forms par
Html formsHtml forms
Html formsHimanshu Pathak
614 vues18 diapositives
htmlcss.pdf par
htmlcss.pdfhtmlcss.pdf
htmlcss.pdfElieMambou1
11 vues57 diapositives

Similaire à Getting Information through HTML Forms(20)

Html tables, forms and audio video par Saad Sheikh
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
Saad Sheikh1.4K vues
Web forms and html (lect 4) par Salman Memon
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)
Salman Memon232 vues
Form using html and java script validation par Maitree Patel
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Maitree Patel1.4K vues
Web engineering - HTML Form par Nosheen Qamar
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML Form
Nosheen Qamar1.6K vues
HTML5 - Forms par tina1357
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
tina13571.5K vues
FormL13.pptx par serd4
FormL13.pptxFormL13.pptx
FormL13.pptx
serd42 vues
INTRODUCTION TO HTML & CSS .pptx par SarthakrOkr
INTRODUCTION TO HTML & CSS .pptxINTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptx
SarthakrOkr22 vues
HTML 5 Simple Tutorial Part 4 par Sanjeev Kumar
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
Sanjeev Kumar128 vues
18servers And Forms par Adil Jafri
18servers And Forms18servers And Forms
18servers And Forms
Adil Jafri187 vues

Plus de Mike Crabb

Hard to Reach Users in Easy to Reach Places par
Hard to Reach Users in Easy to Reach PlacesHard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach PlacesMike Crabb
1.1K vues47 diapositives
Accessible and Assistive Interfaces par
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive InterfacesMike Crabb
692 vues18 diapositives
Accessible Everyone par
Accessible EveryoneAccessible Everyone
Accessible EveryoneMike Crabb
1.4K vues89 diapositives
The Peer Review Process par
The Peer Review ProcessThe Peer Review Process
The Peer Review ProcessMike Crabb
1.8K vues36 diapositives
Managing Quality In Qualitative Research par
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative ResearchMike Crabb
1.6K vues62 diapositives
Analysing Qualitative Data par
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative DataMike Crabb
817 vues59 diapositives

Plus de Mike Crabb(20)

Hard to Reach Users in Easy to Reach Places par Mike Crabb
Hard to Reach Users in Easy to Reach PlacesHard to Reach Users in Easy to Reach Places
Hard to Reach Users in Easy to Reach Places
Mike Crabb1.1K vues
Accessible and Assistive Interfaces par Mike Crabb
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive Interfaces
Mike Crabb692 vues
Accessible Everyone par Mike Crabb
Accessible EveryoneAccessible Everyone
Accessible Everyone
Mike Crabb1.4K vues
The Peer Review Process par Mike Crabb
The Peer Review ProcessThe Peer Review Process
The Peer Review Process
Mike Crabb1.8K vues
Managing Quality In Qualitative Research par Mike Crabb
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative Research
Mike Crabb1.6K vues
Analysing Qualitative Data par Mike Crabb
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative Data
Mike Crabb817 vues
Conversation Discourse and Document Analysis par Mike Crabb
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document Analysis
Mike Crabb479 vues
Ethnographic and Observational Research par Mike Crabb
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational Research
Mike Crabb621 vues
Doing Focus Groups par Mike Crabb
Doing Focus GroupsDoing Focus Groups
Doing Focus Groups
Mike Crabb345 vues
Designing Qualitative Research par Mike Crabb
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative Research
Mike Crabb418 vues
Introduction to Accessible Design par Mike Crabb
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible Design
Mike Crabb177 vues
Accessible Everyone par Mike Crabb
Accessible EveryoneAccessible Everyone
Accessible Everyone
Mike Crabb1.9K vues
Texture and Glyph Design par Mike Crabb
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph Design
Mike Crabb5.4K vues
Pattern Perception and Map Design par Mike Crabb
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map Design
Mike Crabb404 vues
Dealing with Enterprise Level Data par Mike Crabb
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level Data
Mike Crabb1.1K vues
Using Cloud in an Enterprise Environment par Mike Crabb
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise Environment
Mike Crabb2.3K vues
Teaching Cloud to the Programmers of Tomorrow par Mike Crabb
Teaching Cloud to the Programmers of TomorrowTeaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of Tomorrow
Mike Crabb5.6K vues
Sql Injection and XSS par Mike Crabb
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
Mike Crabb3.3K vues
Forms and Databases in PHP par Mike Crabb
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHP
Mike Crabb1.8K vues

Dernier

Sudden Deafness Design Document par
Sudden Deafness Design DocumentSudden Deafness Design Document
Sudden Deafness Design Documentwyfangherman
53 vues19 diapositives
Menu.pdf par
Menu.pdfMenu.pdf
Menu.pdfnyhapedraza
14 vues7 diapositives
500% Sales Growth with Amazon A+ Content par
500% Sales Growth with Amazon A+ Content500% Sales Growth with Amazon A+ Content
500% Sales Growth with Amazon A+ ContentFahima
9 vues5 diapositives
Legal PPT Presentation.pptx par
Legal PPT Presentation.pptxLegal PPT Presentation.pptx
Legal PPT Presentation.pptx125071063
5 vues7 diapositives
Subzero Report (1).pdf par
Subzero Report (1).pdfSubzero Report (1).pdf
Subzero Report (1).pdfsidhantkhanna8
8 vues21 diapositives
The Report is Dead, Long Live the Report ! Communicating Usability Research F... par
The Report is Dead, Long Live the Report ! Communicating Usability Research F...The Report is Dead, Long Live the Report ! Communicating Usability Research F...
The Report is Dead, Long Live the Report ! Communicating Usability Research F...Centralis
8 vues72 diapositives

Dernier(20)

Sudden Deafness Design Document par wyfangherman
Sudden Deafness Design DocumentSudden Deafness Design Document
Sudden Deafness Design Document
wyfangherman53 vues
500% Sales Growth with Amazon A+ Content par Fahima
500% Sales Growth with Amazon A+ Content500% Sales Growth with Amazon A+ Content
500% Sales Growth with Amazon A+ Content
Fahima9 vues
Legal PPT Presentation.pptx par 125071063
Legal PPT Presentation.pptxLegal PPT Presentation.pptx
Legal PPT Presentation.pptx
1250710635 vues
The Report is Dead, Long Live the Report ! Communicating Usability Research F... par Centralis
The Report is Dead, Long Live the Report ! Communicating Usability Research F...The Report is Dead, Long Live the Report ! Communicating Usability Research F...
The Report is Dead, Long Live the Report ! Communicating Usability Research F...
Centralis8 vues
Free World aids day Template from Best presentation design agency par slideceotemplates
Free World aids day Template from Best presentation design agencyFree World aids day Template from Best presentation design agency
Free World aids day Template from Best presentation design agency
DR Portfolio.pptx par robertsd2
DR Portfolio.pptxDR Portfolio.pptx
DR Portfolio.pptx
robertsd218 vues
Business X Design - People, Planet & Product par Cyber-Duck
Business X Design - People, Planet & ProductBusiness X Design - People, Planet & Product
Business X Design - People, Planet & Product
Cyber-Duck25 vues
Using Experiential Design to Understand the Future of AI & Immersive Storytel... par Kent Bye
Using Experiential Design to Understand the Future of AI & Immersive Storytel...Using Experiential Design to Understand the Future of AI & Immersive Storytel...
Using Experiential Design to Understand the Future of AI & Immersive Storytel...
Kent Bye18 vues
Samsung Galaxy Watch 5 Presentation par aryasheel1
Samsung Galaxy Watch 5 PresentationSamsung Galaxy Watch 5 Presentation
Samsung Galaxy Watch 5 Presentation
aryasheel113 vues
Canned Cocktail Flat Labels par nyhapedraza
Canned Cocktail Flat LabelsCanned Cocktail Flat Labels
Canned Cocktail Flat Labels
nyhapedraza16 vues

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 (something@something.something) 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