SlideShare a Scribd company logo
1 of 16
Higher
HTML Forms and Validation
What is a form?
The HTML <form> element creates a form that is used to collect user input. It is
often used along side PHP and can be used for:
 Emailing and contact forms,
 Login and Registration,
 Searching bars,
 Inputting data into an online system
 Updating information on a database
The Form Tag
To create a form in HTML the following tag is used:
<form>
Form elements
</form>
Form Elements
Text
Single line text input
<input type=“text”>
Form Elements
Number
Number input like for example age. This can be limited to a range and will prevent
the user from entering anything other than a number.
<input type=“number”>
Form Elements
Textarea
Used when a paragraph may need to be submitted. Like for example a comment box.
<textarea> Enter text here...</textarea>
Form Elements
Radio Buttons
Used when there is multiple options for the user. For example choice of Gender or
whether they are a student or a teacher.
<input type="radio" > Male
<input type="radio" >Female
<input type="radio" > Other
Form Elements
Select - Drop Down Menu
Used then there is a list of items to choose from.
Select your year:
<Select name=“year”>
<option value=“S4”> S4 </option>
<option value=“S5”> S5 </option>
<option value=“S6”> S6 </option>
</select>
Form Elements
Select – Drop down Menu with Size Attribute
Select element that will offer a number of options and if it is larger than what is stated then a
scroll bar will be given.
Select your car:
<select size="3“>
<option value="volvo">Volvo</option>
<option value="nissan">Nissan</option>
<option value="ford">Ford</option>
<option value="audi">Audi</option>
</select>
Form Elements
Select – Drop down Menu with Size Attribute with multiple choice
Select element that will offer a number of options and if it is larger than what is stated
then a scroll bar will be given.
Select your car:
<select size="3“ multiple>
<option value="volvo">Volvo</option>
<option value="nissan">Nissan</option>
<option value="ford">Ford</option>
<option value="audi">Audi</option>
</select>
Form Elements
Submit Button
When the submit button is pressed the form is submitted and the browser will show
any errors to correct or send the details of the form to the server.
<input type="submit" value="Submit">
Javascript Submit Alerts
Javascript can be used to inform a user that they have enter by using the onclick
function.
<input type="submit" onclick ="alert ('Form Entered')" value="Submit">
Pre populated input
Form elements can be pre populated to help the user understand what is to be inputted. This can be left
unchanged, deleted or even edited by the user.
Username: <input type="text" Value="Enter your Username">
<textarea name="comment" > Enter text here... </textarea>
<input type="radio" name="gender" value="male" checked> Male
Form Validation
Length Check
Prevents the user from entering more that what is required.
<textarea name="comment" maxlength="6">Enter text here...</textarea>
The above will prevent the user from entering anything more than 6 characters.
Form Validation
Presence Check
Ensures that the user has entered something in an important field before submitting to the server.
Username: <input type="text" Value="Enter your Username" required>
Form Validation
Range Check
Ensures that the user has entered a number that is between a set of numbers
<input type="number" name="quantity" min="1" max="5">

More Related Content

What's hot

Support panel mobile user guide for Android - English
Support panel mobile user guide for Android - EnglishSupport panel mobile user guide for Android - English
Support panel mobile user guide for Android - English
ActiveHelper
 
En3405 i web web manager user manual
En3405 i web web manager user manualEn3405 i web web manager user manual
En3405 i web web manager user manual
Heo Gòm
 
Session plan for web technologies lab subject
Session plan for web technologies lab subjectSession plan for web technologies lab subject
Session plan for web technologies lab subject
upen rao
 
APPOL Features Overview
APPOL Features OverviewAPPOL Features Overview
APPOL Features Overview
ryancowsert
 
I requestmanager for_x3
I requestmanager for_x3I requestmanager for_x3
I requestmanager for_x3
garryguddu
 
I requestmanager configuration_and_customization022813
I requestmanager configuration_and_customization022813I requestmanager configuration_and_customization022813
I requestmanager configuration_and_customization022813
garryguddu
 

What's hot (20)

Livehelp Server for WordPress User Guide Ver 3
Livehelp Server for WordPress User Guide Ver 3Livehelp Server for WordPress User Guide Ver 3
Livehelp Server for WordPress User Guide Ver 3
 
Html forms
Html formsHtml forms
Html forms
 
Support Panel Console 3 User Guide
Support  Panel Console 3 User GuideSupport  Panel Console 3 User Guide
Support Panel Console 3 User Guide
 
Building html forms
Building html formsBuilding html forms
Building html forms
 
ActiveHelper Livehelp Server User Guide for Joomla Ver 3 for Joomla 2.5
ActiveHelper Livehelp Server User Guide for Joomla Ver 3 for Joomla 2.5ActiveHelper Livehelp Server User Guide for Joomla Ver 3 for Joomla 2.5
ActiveHelper Livehelp Server User Guide for Joomla Ver 3 for Joomla 2.5
 
ActiveHelper LiveHelp Server Quickstart for Joomla 2.5 & 3.0
ActiveHelper LiveHelp Server Quickstart for Joomla 2.5 & 3.0ActiveHelper LiveHelp Server Quickstart for Joomla 2.5 & 3.0
ActiveHelper LiveHelp Server Quickstart for Joomla 2.5 & 3.0
 
Clean login websitecreationhub.com
Clean login  websitecreationhub.comClean login  websitecreationhub.com
Clean login websitecreationhub.com
 
Support panel mobile user guide for Android - English
Support panel mobile user guide for Android - EnglishSupport panel mobile user guide for Android - English
Support panel mobile user guide for Android - English
 
En3405 i web web manager user manual
En3405 i web web manager user manualEn3405 i web web manager user manual
En3405 i web web manager user manual
 
Translation Company
Translation CompanyTranslation Company
Translation Company
 
Entering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML FormsEntering User Data from a Web Page HTML Forms
Entering User Data from a Web Page HTML Forms
 
Live chat in odoo
Live chat in odooLive chat in odoo
Live chat in odoo
 
Session plan for web technologies lab subject
Session plan for web technologies lab subjectSession plan for web technologies lab subject
Session plan for web technologies lab subject
 
Welcome To Fid Pro
Welcome To Fid ProWelcome To Fid Pro
Welcome To Fid Pro
 
KOMSystems Productivity Benchmarking Application Tutorial
KOMSystems Productivity Benchmarking Application TutorialKOMSystems Productivity Benchmarking Application Tutorial
KOMSystems Productivity Benchmarking Application Tutorial
 
Result Recorder app for windows phone
Result Recorder app for windows phoneResult Recorder app for windows phone
Result Recorder app for windows phone
 
APPOL Features Overview
APPOL Features OverviewAPPOL Features Overview
APPOL Features Overview
 
I requestmanager for_x3
I requestmanager for_x3I requestmanager for_x3
I requestmanager for_x3
 
Blue Dart Shipping Integration WooCommerce
Blue Dart Shipping Integration WooCommerce Blue Dart Shipping Integration WooCommerce
Blue Dart Shipping Integration WooCommerce
 
I requestmanager configuration_and_customization022813
I requestmanager configuration_and_customization022813I requestmanager configuration_and_customization022813
I requestmanager configuration_and_customization022813
 

Similar to Higher - HTML forms

Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
Mudasir Syed
 
Html basics 10 form
Html basics 10 formHtml basics 10 form
Html basics 10 form
H K
 

Similar to Higher - HTML forms (20)

Html forms
Html formsHtml forms
Html forms
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Forms
FormsForms
Forms
 
Lectures-web
Lectures-webLectures-web
Lectures-web
 
Html form tag
Html form tagHtml form tag
Html form tag
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
HTML FORMS.pptx
HTML FORMS.pptxHTML FORMS.pptx
HTML FORMS.pptx
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
Html forms
Html formsHtml forms
Html forms
 
Web forms and html lecture Number 4
Web forms and html lecture Number 4Web forms and html lecture Number 4
Web forms and html lecture Number 4
 
Html forms
Html formsHtml forms
Html forms
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Html basics 10 form
Html basics 10 formHtml basics 10 form
Html basics 10 form
 
HTML_Forms_.ppt
HTML_Forms_.pptHTML_Forms_.ppt
HTML_Forms_.ppt
 
Html form
Html formHtml form
Html form
 
HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4HTML 5 Simple Tutorial Part 4
HTML 5 Simple Tutorial Part 4
 
03 the htm_lforms
03 the htm_lforms03 the htm_lforms
03 the htm_lforms
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
 
Introduction To IBM Lotus Forms Viewer
Introduction To IBM Lotus Forms ViewerIntroduction To IBM Lotus Forms Viewer
Introduction To IBM Lotus Forms Viewer
 
html forms
html formshtml forms
html forms
 

More from missstevenson01

Lesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptxLesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptx
missstevenson01
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptxLesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptx
missstevenson01
 

More from missstevenson01 (20)

S3 environment
S3 environmentS3 environment
S3 environment
 
The Processor.pptx
The Processor.pptxThe Processor.pptx
The Processor.pptx
 
How Computers Work
How Computers WorkHow Computers Work
How Computers Work
 
Lesson 3 - Coding with Minecraft - Variables.pptx
Lesson 3 -  Coding with Minecraft -  Variables.pptxLesson 3 -  Coding with Minecraft -  Variables.pptx
Lesson 3 - Coding with Minecraft - Variables.pptx
 
Lesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptxLesson 2 - Coding with Minecraft - Events.pptx
Lesson 2 - Coding with Minecraft - Events.pptx
 
Lesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptxLesson 1 - Coding with Minecraft -Introduction.pptx
Lesson 1 - Coding with Minecraft -Introduction.pptx
 
Lesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxLesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptx
 
Ethical hacking trojans, worms and spyware
Ethical hacking    trojans, worms and spywareEthical hacking    trojans, worms and spyware
Ethical hacking trojans, worms and spyware
 
Ethical hacking anti virus
Ethical hacking   anti virusEthical hacking   anti virus
Ethical hacking anti virus
 
Ethical hacking introduction to ethical hacking
Ethical hacking   introduction to ethical hackingEthical hacking   introduction to ethical hacking
Ethical hacking introduction to ethical hacking
 
S1 internet safety-chattingonline
S1 internet safety-chattingonlineS1 internet safety-chattingonline
S1 internet safety-chattingonline
 
S3 wireframe diagrams
S3 wireframe diagramsS3 wireframe diagrams
S3 wireframe diagrams
 
Sql
SqlSql
Sql
 
Alien database
Alien databaseAlien database
Alien database
 
Video Games and Copyright laws
Video Games and Copyright lawsVideo Games and Copyright laws
Video Games and Copyright laws
 
Games Design Document
Games Design DocumentGames Design Document
Games Design Document
 
Video game proposal
Video game proposalVideo game proposal
Video game proposal
 
Evaluation
EvaluationEvaluation
Evaluation
 
H evaluation
H evaluationH evaluation
H evaluation
 
H testing and debugging
H testing and debuggingH testing and debugging
H testing and debugging
 

Recently uploaded

Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
ZurliaSoop
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
QucHHunhnh
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
QucHHunhnh
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
heathfieldcps1
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
ciinovamais
 

Recently uploaded (20)

Key note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdfKey note speaker Neum_Admir Softic_ENG.pdf
Key note speaker Neum_Admir Softic_ENG.pdf
 
Sociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning ExhibitSociology 101 Demonstration of Learning Exhibit
Sociology 101 Demonstration of Learning Exhibit
 
Spatium Project Simulation student brief
Spatium Project Simulation student briefSpatium Project Simulation student brief
Spatium Project Simulation student brief
 
Holdier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdfHoldier Curriculum Vitae (April 2024).pdf
Holdier Curriculum Vitae (April 2024).pdf
 
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
Jual Obat Aborsi Hongkong ( Asli No.1 ) 085657271886 Obat Penggugur Kandungan...
 
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
2024-NATIONAL-LEARNING-CAMP-AND-OTHER.pptx
 
1029-Danh muc Sach Giao Khoa khoi 6.pdf
1029-Danh muc Sach Giao Khoa khoi  6.pdf1029-Danh muc Sach Giao Khoa khoi  6.pdf
1029-Danh muc Sach Giao Khoa khoi 6.pdf
 
How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17How to Create and Manage Wizard in Odoo 17
How to Create and Manage Wizard in Odoo 17
 
psychiatric nursing HISTORY COLLECTION .docx
psychiatric  nursing HISTORY  COLLECTION  .docxpsychiatric  nursing HISTORY  COLLECTION  .docx
psychiatric nursing HISTORY COLLECTION .docx
 
Food safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdfFood safety_Challenges food safety laboratories_.pdf
Food safety_Challenges food safety laboratories_.pdf
 
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...Kodo Millet  PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
Kodo Millet PPT made by Ghanshyam bairwa college of Agriculture kumher bhara...
 
1029 - Danh muc Sach Giao Khoa 10 . pdf
1029 -  Danh muc Sach Giao Khoa 10 . pdf1029 -  Danh muc Sach Giao Khoa 10 . pdf
1029 - Danh muc Sach Giao Khoa 10 . pdf
 
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptxSKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
SKILL OF INTRODUCING THE LESSON MICRO SKILLS.pptx
 
The basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptxThe basics of sentences session 3pptx.pptx
The basics of sentences session 3pptx.pptx
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
General Principles of Intellectual Property: Concepts of Intellectual Proper...
General Principles of Intellectual Property: Concepts of Intellectual  Proper...General Principles of Intellectual Property: Concepts of Intellectual  Proper...
General Principles of Intellectual Property: Concepts of Intellectual Proper...
 
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
TỔNG ÔN TẬP THI VÀO LỚP 10 MÔN TIẾNG ANH NĂM HỌC 2023 - 2024 CÓ ĐÁP ÁN (NGỮ Â...
 
This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.This PowerPoint helps students to consider the concept of infinity.
This PowerPoint helps students to consider the concept of infinity.
 
Python Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docxPython Notes for mca i year students osmania university.docx
Python Notes for mca i year students osmania university.docx
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 

Higher - HTML forms

  • 2. What is a form? The HTML <form> element creates a form that is used to collect user input. It is often used along side PHP and can be used for:  Emailing and contact forms,  Login and Registration,  Searching bars,  Inputting data into an online system  Updating information on a database
  • 3. The Form Tag To create a form in HTML the following tag is used: <form> Form elements </form>
  • 4. Form Elements Text Single line text input <input type=“text”>
  • 5. Form Elements Number Number input like for example age. This can be limited to a range and will prevent the user from entering anything other than a number. <input type=“number”>
  • 6. Form Elements Textarea Used when a paragraph may need to be submitted. Like for example a comment box. <textarea> Enter text here...</textarea>
  • 7. Form Elements Radio Buttons Used when there is multiple options for the user. For example choice of Gender or whether they are a student or a teacher. <input type="radio" > Male <input type="radio" >Female <input type="radio" > Other
  • 8. Form Elements Select - Drop Down Menu Used then there is a list of items to choose from. Select your year: <Select name=“year”> <option value=“S4”> S4 </option> <option value=“S5”> S5 </option> <option value=“S6”> S6 </option> </select>
  • 9. Form Elements Select – Drop down Menu with Size Attribute Select element that will offer a number of options and if it is larger than what is stated then a scroll bar will be given. Select your car: <select size="3“> <option value="volvo">Volvo</option> <option value="nissan">Nissan</option> <option value="ford">Ford</option> <option value="audi">Audi</option> </select>
  • 10. Form Elements Select – Drop down Menu with Size Attribute with multiple choice Select element that will offer a number of options and if it is larger than what is stated then a scroll bar will be given. Select your car: <select size="3“ multiple> <option value="volvo">Volvo</option> <option value="nissan">Nissan</option> <option value="ford">Ford</option> <option value="audi">Audi</option> </select>
  • 11. Form Elements Submit Button When the submit button is pressed the form is submitted and the browser will show any errors to correct or send the details of the form to the server. <input type="submit" value="Submit">
  • 12. Javascript Submit Alerts Javascript can be used to inform a user that they have enter by using the onclick function. <input type="submit" onclick ="alert ('Form Entered')" value="Submit">
  • 13. Pre populated input Form elements can be pre populated to help the user understand what is to be inputted. This can be left unchanged, deleted or even edited by the user. Username: <input type="text" Value="Enter your Username"> <textarea name="comment" > Enter text here... </textarea> <input type="radio" name="gender" value="male" checked> Male
  • 14. Form Validation Length Check Prevents the user from entering more that what is required. <textarea name="comment" maxlength="6">Enter text here...</textarea> The above will prevent the user from entering anything more than 6 characters.
  • 15. Form Validation Presence Check Ensures that the user has entered something in an important field before submitting to the server. Username: <input type="text" Value="Enter your Username" required>
  • 16. Form Validation Range Check Ensures that the user has entered a number that is between a set of numbers <input type="number" name="quantity" min="1" max="5">