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

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 3ActiveHelper
 
Support Panel Console 3 User Guide
Support  Panel Console 3 User GuideSupport  Panel Console 3 User Guide
Support Panel Console 3 User GuideActiveHelper
 
Building html forms
Building html formsBuilding html forms
Building html formsice es
 
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.5ActiveHelper
 
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.0ActiveHelper
 
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 - EnglishActiveHelper
 
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 manualHeo Gòm
 
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 Formssathish sak
 
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 subjectupen rao
 
KOMSystems Productivity Benchmarking Application Tutorial
KOMSystems Productivity Benchmarking Application TutorialKOMSystems Productivity Benchmarking Application Tutorial
KOMSystems Productivity Benchmarking Application Tutorialkomsystems
 
Result Recorder app for windows phone
Result Recorder app for windows phoneResult Recorder app for windows phone
Result Recorder app for windows phoneMannu Malhotra
 
APPOL Features Overview
APPOL Features OverviewAPPOL Features Overview
APPOL Features Overviewryancowsert
 
I requestmanager for_x3
I requestmanager for_x3I requestmanager for_x3
I requestmanager for_x3garryguddu
 
Blue Dart Shipping Integration WooCommerce
Blue Dart Shipping Integration WooCommerce Blue Dart Shipping Integration WooCommerce
Blue Dart Shipping Integration WooCommerce SoftProdigy
 
I requestmanager configuration_and_customization022813
I requestmanager configuration_and_customization022813I requestmanager configuration_and_customization022813
I requestmanager configuration_and_customization022813garryguddu
 

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 (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 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.pptxmissstevenson01
 
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.pptxmissstevenson01
 
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.pptxmissstevenson01
 
Lesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxLesson2 - Coding with Minecraft - Events.pptx
Lesson2 - Coding with Minecraft - Events.pptxmissstevenson01
 
Ethical hacking trojans, worms and spyware
Ethical hacking    trojans, worms and spywareEthical hacking    trojans, worms and spyware
Ethical hacking trojans, worms and spywaremissstevenson01
 
Ethical hacking anti virus
Ethical hacking   anti virusEthical hacking   anti virus
Ethical hacking anti virusmissstevenson01
 
Ethical hacking introduction to ethical hacking
Ethical hacking   introduction to ethical hackingEthical hacking   introduction to ethical hacking
Ethical hacking introduction to ethical hackingmissstevenson01
 
S1 internet safety-chattingonline
S1 internet safety-chattingonlineS1 internet safety-chattingonline
S1 internet safety-chattingonlinemissstevenson01
 
Video Games and Copyright laws
Video Games and Copyright lawsVideo Games and Copyright laws
Video Games and Copyright lawsmissstevenson01
 

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

INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxHumphrey A Beña
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxVanesaIglesias10
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYKayeClaireEstoconing
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management systemChristalin Nelson
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptxmary850239
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsManeerUddin
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxleah joy valeriano
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4JOYLYNSAMANIEGO
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptxmary850239
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...Postal Advocate Inc.
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptxmary850239
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management SystemChristalin Nelson
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfJemuel Francisco
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxiammrhaywood
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfPatidar M
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxlancelewisportillo
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationRosabel UA
 

Recently uploaded (20)

FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptxFINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
FINALS_OF_LEFT_ON_C'N_EL_DORADO_2024.pptx
 
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptxINTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
INTRODUCTION TO CATHOLIC CHRISTOLOGY.pptx
 
ROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptxROLES IN A STAGE PRODUCTION in arts.pptx
ROLES IN A STAGE PRODUCTION in arts.pptx
 
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITYISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
ISYU TUNGKOL SA SEKSWLADIDA (ISSUE ABOUT SEXUALITY
 
Concurrency Control in Database Management system
Concurrency Control in Database Management systemConcurrency Control in Database Management system
Concurrency Control in Database Management system
 
4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx4.18.24 Movement Legacies, Reflection, and Review.pptx
4.18.24 Movement Legacies, Reflection, and Review.pptx
 
Food processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture honsFood processing presentation for bsc agriculture hons
Food processing presentation for bsc agriculture hons
 
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptxMusic 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
Music 9 - 4th quarter - Vocal Music of the Romantic Period.pptx
 
Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4Daily Lesson Plan in Mathematics Quarter 4
Daily Lesson Plan in Mathematics Quarter 4
 
4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx4.16.24 21st Century Movements for Black Lives.pptx
4.16.24 21st Century Movements for Black Lives.pptx
 
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
USPS® Forced Meter Migration - How to Know if Your Postage Meter Will Soon be...
 
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptxYOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
YOUVE_GOT_EMAIL_PRELIMS_EL_DORADO_2024.pptx
 
4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx4.16.24 Poverty and Precarity--Desmond.pptx
4.16.24 Poverty and Precarity--Desmond.pptx
 
Transaction Management in Database Management System
Transaction Management in Database Management SystemTransaction Management in Database Management System
Transaction Management in Database Management System
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdfGrade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
Grade 9 Quarter 4 Dll Grade 9 Quarter 4 DLL.pdf
 
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptxECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
ECONOMIC CONTEXT - PAPER 1 Q3: NEWSPAPERS.pptx
 
Active Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdfActive Learning Strategies (in short ALS).pdf
Active Learning Strategies (in short ALS).pdf
 
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptxQ4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
Q4-PPT-Music9_Lesson-1-Romantic-Opera.pptx
 
Activity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translationActivity 2-unit 2-update 2024. English translation
Activity 2-unit 2-update 2024. English translation
 

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