SlideShare ist ein Scribd-Unternehmen logo
1 von 42
Downloaden Sie, um offline zu lesen
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/ļ¬le 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
ā€¢ <ļ¬eldset> ā€¦ </ļ¬eldset>
Basic form elements
<form>
<ļ¬eldset>
<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" />
</ļ¬eldset>
</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>
<ļ¬eldset>
<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" />
</ļ¬eldset>
</form>
<style> input, textarea {width: 400px;} </style>
<form>
<ļ¬eldset>
<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>
</ļ¬eldset>
</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=ā€œļ¬rstname>First name:</label><br>
<input type="text" name="ļ¬rstname"><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="ļ¬rstname" 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 ļ¬elds 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 speciļ¬es the initial value for an
input ļ¬eld:
value
<form action="">
First name:<br>
<input type="text" name="ļ¬rstname" value="John">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
ā€¢ The readonly attribute speciļ¬es that the input ļ¬eld
is read only (cannot be changed)
read only
<form action="">
First name:<br>
<input type="text" name="ļ¬rstname" value="John" readonly>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
ā€¢ The disabled attribute speciļ¬es that the input ļ¬eld
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="ļ¬rstname" value="John" disabled>
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
ā€¢ The size attribute speciļ¬es the size (in characters)
for the input ļ¬eld
size
<form action="">
First name:<br>
<input type="text" name="ļ¬rstname" value="John" size="40">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
ā€¢ The maxlength attribute speciļ¬es the maximum
allowed length for the input ļ¬eld:
maxlength
<form action="">
First name:<br>
<input type="text" name="ļ¬rstname" maxlength="10">
<br>
Last name:<br>
<input type="text" name="lastname">
</form>
ā€¢ The autocomplete attribute speciļ¬es whether a
form or input ļ¬eld should have autocomplete on or
oļ¬€
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="oļ¬€"><br>
<input type="submit">
</form>
placeholder
ā€¢ The placeholder attribute speciļ¬es a hint that
describes the expected value of an input ļ¬eld (a
sample value or a short description of the format).
<input type="text" name="fname" placeholder="First name">
required
ā€¢ When present, it speciļ¬es that an input ļ¬eld must
be ļ¬lled 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 ļ¬le.
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 ļ¬nd 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

Weitere Ƥhnliche Inhalte

Was ist angesagt?

How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...
How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...
How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...
Volume Nine
Ā 

Was ist angesagt? (20)

Learn Prompting with ChatGPT
Learn Prompting with ChatGPTLearn Prompting with ChatGPT
Learn Prompting with ChatGPT
Ā 
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business32 Ways a Digital Marketing Consultant Can Help Grow Your Business
32 Ways a Digital Marketing Consultant Can Help Grow Your Business
Ā 
How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...
How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...
How to Use AI (Like ChatGPT & Bard) in your SEO & Content - A Comprehensive S...
Ā 
eCommerce SEO
eCommerce SEOeCommerce SEO
eCommerce SEO
Ā 
What Are the Problems Associated with ChatGPT?
What Are the Problems Associated with ChatGPT?What Are the Problems Associated with ChatGPT?
What Are the Problems Associated with ChatGPT?
Ā 
ChatGPT Prompt Engineering
ChatGPT Prompt EngineeringChatGPT Prompt Engineering
ChatGPT Prompt Engineering
Ā 
5 BENIFITES OF CHAT GPT.pptx
5 BENIFITES OF CHAT GPT.pptx5 BENIFITES OF CHAT GPT.pptx
5 BENIFITES OF CHAT GPT.pptx
Ā 
Awesome Prompts Naveed.pdf
Awesome Prompts Naveed.pdfAwesome Prompts Naveed.pdf
Awesome Prompts Naveed.pdf
Ā 
Introduction to ChatGPT
Introduction to ChatGPTIntroduction to ChatGPT
Introduction to ChatGPT
Ā 
ChatGPT 101 - Vancouver ChatGPT Experts
ChatGPT 101 - Vancouver ChatGPT ExpertsChatGPT 101 - Vancouver ChatGPT Experts
ChatGPT 101 - Vancouver ChatGPT Experts
Ā 
Html / CSS Presentation
Html / CSS PresentationHtml / CSS Presentation
Html / CSS Presentation
Ā 
types of prompts 1.0.pdf
types of prompts 1.0.pdftypes of prompts 1.0.pdf
types of prompts 1.0.pdf
Ā 
Webinar on ChatGPT.pptx
Webinar on ChatGPT.pptxWebinar on ChatGPT.pptx
Webinar on ChatGPT.pptx
Ā 
Blueprint ChatGPT Lunch & Learn
Blueprint ChatGPT Lunch & LearnBlueprint ChatGPT Lunch & Learn
Blueprint ChatGPT Lunch & Learn
Ā 
Prompt Engineering.pptx
Prompt Engineering.pptxPrompt Engineering.pptx
Prompt Engineering.pptx
Ā 
ChatGPT Content Creation Master Class - Leah Faul, 15000 Cubits
ChatGPT Content Creation Master Class - Leah Faul, 15000 CubitsChatGPT Content Creation Master Class - Leah Faul, 15000 Cubits
ChatGPT Content Creation Master Class - Leah Faul, 15000 Cubits
Ā 
Html
HtmlHtml
Html
Ā 
Html, CSS & Web Designing
Html, CSS & Web DesigningHtml, CSS & Web Designing
Html, CSS & Web Designing
Ā 
Code completion using OpenAI APIs.pptx
Code completion using OpenAI APIs.pptxCode completion using OpenAI APIs.pptx
Code completion using OpenAI APIs.pptx
Ā 
BrightonSEO - SearchPilot - Will Critchlow - Lessons from 100s of SEO tests
BrightonSEO - SearchPilot - Will Critchlow - Lessons from 100s of SEO testsBrightonSEO - SearchPilot - Will Critchlow - Lessons from 100s of SEO tests
BrightonSEO - SearchPilot - Will Critchlow - Lessons from 100s of SEO tests
Ā 

Andere mochten auch

Andere mochten auch (20)

Montreal Girl Geeks: Building the Modern Web
Montreal Girl Geeks: Building the Modern WebMontreal Girl Geeks: Building the Modern Web
Montreal Girl Geeks: Building the Modern Web
Ā 
DESIGN THE PRIORITY, PERFORMANCE ā€ØAND UX
DESIGN THE PRIORITY, PERFORMANCE ā€ØAND UXDESIGN THE PRIORITY, PERFORMANCE ā€ØAND UX
DESIGN THE PRIORITY, PERFORMANCE ā€ØAND UX
Ā 
Internet of Things - The Tip of an Iceberg
Internet of Things - The Tip of an IcebergInternet of Things - The Tip of an Iceberg
Internet of Things - The Tip of an Iceberg
Ā 
Introduction to Development for the Internet
Introduction to Development for the InternetIntroduction to Development for the Internet
Introduction to Development for the Internet
Ā 
Node.js and The Internet of Things
Node.js and The Internet of ThingsNode.js and The Internet of Things
Node.js and The Internet of Things
Ā 
Finding Our Happy Place in the Internet of Things
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
Ā 
Build Features, Not Apps
Build Features, Not AppsBuild Features, Not Apps
Build Features, Not Apps
Ā 
Valentine's Day
Valentine's DayValentine's Day
Valentine's Day
Ā 
Health and Well-Being on the Social Web
Health and Well-Being on the Social WebHealth and Well-Being on the Social Web
Health and Well-Being on the Social Web
Ā 
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)
How Much Further Will Internet Stocks Fall? (Share Price Performance)
Ā 
Net neutrality: The Basics
Net neutrality: The BasicsNet neutrality: The Basics
Net neutrality: The Basics
Ā 
Visual Design with Data
Visual Design with DataVisual Design with Data
Visual Design with Data
Ā 
25 Festive Fonts For Women Oriented Businesses!
25 Festive Fonts For Women Oriented Businesses!25 Festive Fonts For Women Oriented Businesses!
25 Festive Fonts For Women Oriented Businesses!
Ā 
Digital in 2016
Digital in 2016Digital in 2016
Digital in 2016
Ā 
Designing Teams for Emerging Challenges
Designing Teams for Emerging ChallengesDesigning Teams for Emerging Challenges
Designing Teams for Emerging Challenges
Ā 
Study: The Future of VR, AR and Self-Driving Cars
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
Ā 
Mobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigitalMobile-First SEO - The Marketers Edition #3XEDigital
Mobile-First SEO - The Marketers Edition #3XEDigital
Ā 
Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)Mobile Is Eating the World (2016)
Mobile Is Eating the World (2016)
Ā 
UX, ethnography and possibilities: for Libraries, Museums and Archives
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
Ā 
IT in Healthcare
IT in HealthcareIT in Healthcare
IT in Healthcare
Ā 

Ƅhnlich wie Getting Information through HTML Forms

Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Maitree Patel
Ā 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
tina1357
Ā 
FormL13.pptx
FormL13.pptxFormL13.pptx
FormL13.pptx
serd4
Ā 
Lesson 15
Lesson 15Lesson 15
Lesson 15
Gene Babon
Ā 

Ƅhnlich wie Getting Information through HTML Forms (20)

Html tables, forms and audio video
Html tables, forms and audio videoHtml tables, forms and audio video
Html tables, forms and audio video
Ā 
Web forms and html (lect 4)
Web forms and html (lect 4)Web forms and html (lect 4)
Web forms and html (lect 4)
Ā 
Form using html and java script validation
Form using html and java script validationForm using html and java script validation
Form using html and java script validation
Ā 
Forms
FormsForms
Forms
Ā 
Html forms
Html formsHtml forms
Html forms
Ā 
htmlcss.pdf
htmlcss.pdfhtmlcss.pdf
htmlcss.pdf
Ā 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
Ā 
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
Ā 
Web engineering - HTML Form
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML Form
Ā 
HTML Forms Basics by Kamran Solangi.pptx
HTML Forms Basics by Kamran Solangi.pptxHTML Forms Basics by Kamran Solangi.pptx
HTML Forms Basics by Kamran Solangi.pptx
Ā 
HTML5 - Forms
HTML5 - FormsHTML5 - Forms
HTML5 - Forms
Ā 
Forms Part 1
Forms Part 1Forms Part 1
Forms Part 1
Ā 
Unit 2 (it workshop)
Unit 2 (it workshop)Unit 2 (it workshop)
Unit 2 (it workshop)
Ā 
FormL13.pptx
FormL13.pptxFormL13.pptx
FormL13.pptx
Ā 
HTML
HTML HTML
HTML
Ā 
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
Ā 
Lesson 15
Lesson 15Lesson 15
Lesson 15
Ā 
INTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptxINTRODUCTION TO HTML & CSS .pptx
INTRODUCTION TO HTML & CSS .pptx
Ā 

Mehr von Mike Crabb

Mehr von Mike Crabb (20)

Hard to Reach Users in Easy to Reach Places
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
Ā 
Accessible and Assistive Interfaces
Accessible and Assistive InterfacesAccessible and Assistive Interfaces
Accessible and Assistive Interfaces
Ā 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
Ā 
The Peer Review Process
The Peer Review ProcessThe Peer Review Process
The Peer Review Process
Ā 
Managing Quality In Qualitative Research
Managing Quality In Qualitative ResearchManaging Quality In Qualitative Research
Managing Quality In Qualitative Research
Ā 
Analysing Qualitative Data
Analysing Qualitative DataAnalysing Qualitative Data
Analysing Qualitative Data
Ā 
Conversation Discourse and Document Analysis
Conversation Discourse and Document AnalysisConversation Discourse and Document Analysis
Conversation Discourse and Document Analysis
Ā 
Ethnographic and Observational Research
Ethnographic and Observational ResearchEthnographic and Observational Research
Ethnographic and Observational Research
Ā 
Doing Focus Groups
Doing Focus GroupsDoing Focus Groups
Doing Focus Groups
Ā 
Doing Interviews
Doing InterviewsDoing Interviews
Doing Interviews
Ā 
Designing Qualitative Research
Designing Qualitative ResearchDesigning Qualitative Research
Designing Qualitative Research
Ā 
Introduction to Accessible Design
Introduction to Accessible DesignIntroduction to Accessible Design
Introduction to Accessible Design
Ā 
Accessible Everyone
Accessible EveryoneAccessible Everyone
Accessible Everyone
Ā 
Texture and Glyph Design
Texture and Glyph DesignTexture and Glyph Design
Texture and Glyph Design
Ā 
Pattern Perception and Map Design
Pattern Perception and Map DesignPattern Perception and Map Design
Pattern Perception and Map Design
Ā 
Dealing with Enterprise Level Data
Dealing with Enterprise Level DataDealing with Enterprise Level Data
Dealing with Enterprise Level Data
Ā 
Using Cloud in an Enterprise Environment
Using Cloud in an Enterprise EnvironmentUsing Cloud in an Enterprise Environment
Using Cloud in an Enterprise Environment
Ā 
Teaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of TomorrowTeaching Cloud to the Programmers of Tomorrow
Teaching Cloud to the Programmers of Tomorrow
Ā 
Sql Injection and XSS
Sql Injection and XSSSql Injection and XSS
Sql Injection and XSS
Ā 
Forms and Databases in PHP
Forms and Databases in PHPForms and Databases in PHP
Forms and Databases in PHP
Ā 

KĆ¼rzlich hochgeladen

VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
SUHANI PANDEY
Ā 
äø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁ
äø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁäø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁ
äø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁ
wpkuukw
Ā 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
tbatkhuu1
Ā 
Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard ...
Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard  ...Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard  ...
Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard ...
nirzagarg
Ā 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
TusharBahuguna2
Ā 
Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...
nirzagarg
Ā 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
mark11275
Ā 
Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...
amitlee9823
Ā 
Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...
Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...
Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...
amitlee9823
Ā 
HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...
poojakaurpk09
Ā 
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
amitlee9823
Ā 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
home
Ā 

KĆ¼rzlich hochgeladen (20)

VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
VIP Model Call Girls Kalyani Nagar ( Pune ) Call ON 8005736733 Starting From ...
Ā 
äø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁ
äø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁäø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁ
äø€ęƔäø€å®š(č“­)協尔é”æ大学ęƕäøščƁ(CUęƕäøščƁ)ꈐē»©å•å­¦ä½čƁ
Ā 
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...AMBER GRAIN EMBROIDERY | Growing folklore elements |  Root-based materials, w...
AMBER GRAIN EMBROIDERY | Growing folklore elements | Root-based materials, w...
Ā 
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdfJordan_Amanda_DMBS202404_PB1_2024-04.pdf
Jordan_Amanda_DMBS202404_PB1_2024-04.pdf
Ā 
Peaches App development presentation deck
Peaches App development presentation deckPeaches App development presentation deck
Peaches App development presentation deck
Ā 
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Pooja 9892124323, Call girls Services and Mumbai Escort Service Near Hotel Gi...
Ā 
ā¤Personal Whatsapp Number 8617697112 Samba Call Girls šŸ’¦āœ….
ā¤Personal Whatsapp Number 8617697112 Samba Call Girls šŸ’¦āœ….ā¤Personal Whatsapp Number 8617697112 Samba Call Girls šŸ’¦āœ….
ā¤Personal Whatsapp Number 8617697112 Samba Call Girls šŸ’¦āœ….
Ā 
call girls in Kaushambi (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”...
call girls in Kaushambi (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”...call girls in Kaushambi (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”...
call girls in Kaushambi (Ghaziabad) šŸ” >ą¼’8448380779 šŸ” genuine Escort Service šŸ”...
Ā 
WhatsApp Chat: šŸ“ž 8617697112 Call Girl Baran is experienced
WhatsApp Chat: šŸ“ž 8617697112 Call Girl Baran is experiencedWhatsApp Chat: šŸ“ž 8617697112 Call Girl Baran is experienced
WhatsApp Chat: šŸ“ž 8617697112 Call Girl Baran is experienced
Ā 
Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard ...
Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard  ...Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard  ...
Anamika Escorts Service Darbhanga ā£ļø 7014168258 ā£ļø High Cost Unlimited Hard ...
Ā 
Design Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptxDesign Inspiration for College by Slidesgo.pptx
Design Inspiration for College by Slidesgo.pptx
Ā 
Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...
Nisha Yadav Escorts Service Ernakulam ā£ļø 7014168258 ā£ļø High Cost Unlimited Ha...
Ā 
How to Build a Simple Shopify Website
How to Build a Simple Shopify WebsiteHow to Build a Simple Shopify Website
How to Build a Simple Shopify Website
Ā 
Real service provider college girl Mira Road 8976425520
Real service provider college girl Mira Road 8976425520Real service provider college girl Mira Road 8976425520
Real service provider college girl Mira Road 8976425520
Ā 
Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...
Call Girls Basavanagudi Just Call šŸ‘— 7737669865 šŸ‘— Top Class Call Girl Service ...
Ā 
Top Rated Pune Call Girls Koregaon Park āŸŸ 6297143586 āŸŸ Call Me For Genuine S...
Top Rated  Pune Call Girls Koregaon Park āŸŸ 6297143586 āŸŸ Call Me For Genuine S...Top Rated  Pune Call Girls Koregaon Park āŸŸ 6297143586 āŸŸ Call Me For Genuine S...
Top Rated Pune Call Girls Koregaon Park āŸŸ 6297143586 āŸŸ Call Me For Genuine S...
Ā 
Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...
Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...
Brookefield Call Girls: šŸ“ 7737669865 šŸ“ High Profile Model Escorts | Bangalore...
Ā 
HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...
HiFi Call Girl Service Delhi Phone ā˜ž 9899900591 ā˜œ Escorts Service at along wi...
Ā 
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Vip Mumbai Call Girls Bandra West Call On 9920725232 With Body to body massag...
Ā 
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Recommendable # 971589162217 # philippine Young Call Girls in Dubai By Marina...
Ā 

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/ļ¬le 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 ā€¢ <ļ¬eldset> ā€¦ </ļ¬eldset> Basic form elements
  • 8. <form> <ļ¬eldset> <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" /> </ļ¬eldset> </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> <ļ¬eldset> <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" /> </ļ¬eldset> </form>
  • 11. <style> input, textarea {width: 400px;} </style> <form> <ļ¬eldset> <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> </ļ¬eldset> </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=ā€œļ¬rstname>First name:</label><br> <input type="text" name="ļ¬rstname"><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="ļ¬rstname" 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 ļ¬elds 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 speciļ¬es the initial value for an input ļ¬eld: value <form action=""> First name:<br> <input type="text" name="ļ¬rstname" value="John"> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 28. ā€¢ The readonly attribute speciļ¬es that the input ļ¬eld is read only (cannot be changed) read only <form action=""> First name:<br> <input type="text" name="ļ¬rstname" value="John" readonly> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 29. ā€¢ The disabled attribute speciļ¬es that the input ļ¬eld 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="ļ¬rstname" value="John" disabled> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 30. ā€¢ The size attribute speciļ¬es the size (in characters) for the input ļ¬eld size <form action=""> First name:<br> <input type="text" name="ļ¬rstname" value="John" size="40"> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 31. ā€¢ The maxlength attribute speciļ¬es the maximum allowed length for the input ļ¬eld: maxlength <form action=""> First name:<br> <input type="text" name="ļ¬rstname" maxlength="10"> <br> Last name:<br> <input type="text" name="lastname"> </form>
  • 32. ā€¢ The autocomplete attribute speciļ¬es whether a form or input ļ¬eld should have autocomplete on or oļ¬€ 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="oļ¬€"><br> <input type="submit"> </form>
  • 33. placeholder ā€¢ The placeholder attribute speciļ¬es a hint that describes the expected value of an input ļ¬eld (a sample value or a short description of the format). <input type="text" name="fname" placeholder="First name">
  • 34. required ā€¢ When present, it speciļ¬es that an input ļ¬eld must be ļ¬lled 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 ļ¬le. 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 ļ¬nd 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