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

Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
AnaAcapella
 
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
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
kauryashika82
 

Recently uploaded (20)

On National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan FellowsOn National Teacher Day, meet the 2024-25 Kenan Fellows
On National Teacher Day, meet the 2024-25 Kenan Fellows
 
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
 
How to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POSHow to Manage Global Discount in Odoo 17 POS
How to Manage Global Discount in Odoo 17 POS
 
Spellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please PractiseSpellings Wk 3 English CAPS CARES Please Practise
Spellings Wk 3 English CAPS CARES Please Practise
 
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
 
Unit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptxUnit-IV; Professional Sales Representative (PSR).pptx
Unit-IV; Professional Sales Representative (PSR).pptx
 
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
Explore beautiful and ugly buildings. Mathematics helps us create beautiful d...
 
Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024Mehran University Newsletter Vol-X, Issue-I, 2024
Mehran University Newsletter Vol-X, Issue-I, 2024
 
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...
 
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
 
Activity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdfActivity 01 - Artificial Culture (1).pdf
Activity 01 - Artificial Culture (1).pdf
 
Third Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptxThird Battle of Panipat detailed notes.pptx
Third Battle of Panipat detailed notes.pptx
 
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in DelhiRussian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
Russian Escort Service in Delhi 11k Hotel Foreigner Russian Call Girls in Delhi
 
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
 
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
 
microwave assisted reaction. General introduction
microwave assisted reaction. General introductionmicrowave assisted reaction. General introduction
microwave assisted reaction. General introduction
 
How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17How to Give a Domain for a Field in Odoo 17
How to Give a Domain for a Field in Odoo 17
 
Unit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptxUnit-IV- Pharma. Marketing Channels.pptx
Unit-IV- Pharma. Marketing Channels.pptx
 
Micro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdfMicro-Scholarship, What it is, How can it help me.pdf
Micro-Scholarship, What it is, How can it help me.pdf
 
Understanding Accommodations and Modifications
Understanding  Accommodations and ModificationsUnderstanding  Accommodations and Modifications
Understanding Accommodations and Modifications
 

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">