SlideShare ist ein Scribd-Unternehmen logo
1 von 28
HTML Forms
Acknowledgements: www.w3schools.com
1Computer Network & Web Tech (SET, JU)
HTML Forms
 HTML Forms used to collect user input
 <form> element defines an HTML form
<form>
.
form elements
.
</form>
 An HTML form contains form elements
 Different types of input elements, like text fields,
checkboxes, radio buttons, submit buttons, and more
First name:
Last name:
2Computer Network & Web Tech (SET, JU)
Bose
Form Attributes
Element Description
action Specifies an address (url) where to submit
the form (default)
autocomplete Specifies if the browser should
autocomplete the form (default: on).
enctype Specifies the encoding of the submitted data
(default: is url-encoded).
method Specifies the HTTP method used when
submitting the data
name Used to identify the form
novalidate Specifies that the browser should not
validate the form.
target Specifies the target of the address in the
action attribute
3Computer Network & Web Tech (SET, JU)
Form Attributes (contd..)
<form action="/action_page.php" novalidate
method=“get”>
E mail: <input type="email" name="user_email”>
<input type="submit” formtarget="_blank”
value="Submit to a new window">
<input type="submit" formaction="/action_page2.php”
value="Submit as admin">
</form>
(see 1a.htm, 1b.htm)
4Computer Network & Web Tech (SET, JU)
Method Attribute
 Default method when submitting form data is GET
 When GET is used, the submitted form data will be visible in the
page address field
action_page.php?firstname=Mickey&lastname=Mouse
 Suited for short, insensitive information
 When POST is used, submitted data is part of body, not visible in
page address field
 Used for sensitive information
 POST has no size limitations,
can be used to send large amounts of data
5Computer Network & Web Tech (SET, JU)
Input Element
 <input> - most important form element
 Can be displayed in different ways depending on type attribute
Type Description
<input type="text"> Defines a one-line text input field
<input type="radio"> Defines a radio button
(for selecting one of many choices)
<input type="submit"> Defines a submit button
(for submitting the form)
6Computer Network & Web Tech (SET, JU)
Text Input
 <input> - most important form element
 Can be displayed in different ways depending on type attribute
• Attributes
Readonly, disabled, maxlength, size, required, autofocus,
autocomplete, placeholder, pattern, title, max, min, step
 Default width of a text field is 20 characters. (see 1.htm)
<form>
First name:<br>
<input type="text" name="firstname” value=“Arnab” size=20> <br>
Last name:<br>
<input type="text" name="lastname” value=“Bose” size=30 >
</form>
7Computer Network & Web Tech (SET, JU)
Text Input (contd..)
<form autocomplete=“on”>
First name:
<input type="text" name="firstname”> <br>
Last name:
<input type="text" name="lastname”> <br>
Email:
<input type="text" name=“email” autocomplete=“off”> <br>
Country Code:
<input type="text" name=“cntrycode” pattern=“[A-Za-z]{3}
title="Three letter country code”>
</form>
8Computer Network & Web Tech (SET, JU)
Password
<input type=“password”>
<form>
First name:
<input type="text" name="firstname”> <br>
Last name:
<input type="text" name="lastname”> <br>
Password:
<input type=“password" name=“psw”> <br>
</form>
9Computer Network & Web Tech (SET, JU)
Submit Button
<input type=“submit”>
 Defines a button for submitting form data to a form handler
o Typically a server page with a script for processing the data
o Specified in the form's action attribute
o If action attribute omitted, handled by the same page
 If value for type “submit” element omitted, default text
<form action=“/action_page.php”>
First name:
<input type="text" name="firstname”> <br>
Last name:
<input type="text" name="lastname”> <br>
<input type=“submit" value=“submit”> <br>
</form> 10Computer Network & Web Tech (SET, JU)
Reset Button
<input type=“reset”>
 Defines a reset button
o Will reset all form values to their default values
<form action=“/action_page.php”>
First name:
<input type="text" name="firstname”> <br>
Last name:
<input type="text" name="lastname”> <br>
<input type=“submit" value=“submit”> <br>
<input type=“reset" >
</form>
11Computer Network & Web Tech (SET, JU)
Radio Buttons
<input type=“radio”>
 Defines a radio button
o lets a user select ONLY ONE out of
a limited number of choices
<form action=“/action_page.php”>
<input type="radio" name="gender" value="male" checked> Male<br>
<input type="radio" name="gender" value="female"> Female<br>
<input type="radio" name="gender" value="other"> Other
</form>
12Computer Network & Web Tech (SET, JU)
Checkbox
<input type=“checkbox”>
 Defines a checkbox
o Checkboxes let a user select ZERO or MORE options of a limited
number of choices
<form action=“/action_page.php”>
<input type="checkbox" name="vhcl1" value="Bike"> I have a bike<br>
<input type="checkbox" name="vhcl2" value="Car"> I have a car
</form> see 2.htm
13Computer Network & Web Tech (SET, JU)
Button
<input type=“button”>
 Defines a clickable button
<form action=“/action_page.php”>
First name:
<input type="text" name="firstname”> <br>
Last name:
<input type="text" name="lastname”> <br>
<input type=“button“ onclick="alert('Hello
World!')" value="Click Me!">
</form>
14Computer Network & Web Tech (SET, JU)
Addition input types – HTML5
 When not supported by older browsers, act as text
o number, color, date, month,week, range, email, URL
<input type=“number" name=“qty” min=“0”
name=“100” step=“10” >
<input type=“range" name=“points” min=“0”
name=“100” step=“2” value=“50” >
<input type="email" name="email">
<input type=“URL" name=“homepage">
15Computer Network & Web Tech (SET, JU)
HTML5 input types (contd..)
Depending on browser support, a date or time picker can show up in the input field
Enter a date before 1980-01-01:
<input type="date" name="bday" max="1979-12-31">
Enter a date after 2000-01-01:
<input type="datetime-local" name="bday" min="2000-01-
02">
<input type="month" name="bdaymonth“ >
<input type="week" name="week_year">
<input type="time" name="usr_time">
<input type="color" name="favcolor">
See 3.htm
16Computer Network & Web Tech (SET, JU)
Select Element
<select>
 Defines a dropdown list
o <option> elements defines an option that can be selected
o By default, the first item in the drop-down list is selected.
o To define a pre-selected option, add selected attribute to option
<select name=“cars”>
<option value=“audi”> Audi </option>
<option value=“mercedes” selected>
Mercedes </option>
<option value=“bmw”> BMW </option>
<select name=“cars”>
</form> 17Computer Network & Web Tech (SET, JU)
DataList Element
<datalist>
 Defines a dropdown list for an input element (new in HTML5)
o Users will see drop-down list of pre-defined options as they input data
o list attribute of <input> element must refer id attribute of <datalist>
<input list=“browsers”>
<datalist id=“browsers”>
<option value=“firefox”> Firefox </option>
<option value=“chrome”> chrome </option>
<option value=“ie”> Internet Explorer</option>
< /datalist>
18Computer Network & Web Tech (SET, JU)
Textarea Element
<textarea>
 Defines a multiline input field
o rows and columns can be defined
o row attribute defines number of visible lines
o col attribute defines visible width
<textarea name=“message” rows=“10” cols=“30” >
The fox jumped over the fence </textarea>
See 4.htm
19Computer Network & Web Tech (SET, JU)
Some more Elements..
Element Description
<label> Defines a label for an <input> element
<fieldset> Groups related elements in a form
<optgroup> Defines a group of related options in a drop-
down list
<output> Defines the result of a calculation
20Computer Network & Web Tech (SET, JU)
Block & Inline Elements
Grouping Elements (DIV,SPAN)
21Computer Network & Web Tech (SET, JU)
Block Element
 Start on a new line & take full available width
 Examples
o <h1> to <h6>
o <p>
o <div>
o <form>
22Computer Network & Web Tech (SET, JU)
Div Element
 Grouping element, generally used to style a block of content
 Often used as container for other elements
 No required attributes, often used with <style> & <class>
 Example
<div style==“backgroundcolor:black; color:white; padding:20px;” >
<h2> London </h2>
<p> Capital of UK </p>
</div>
See h1.htm 23Computer Network & Web Tech (SET, JU)
DIV: Using class attribute
Makes it easier to define equal styles for elements with same class
Example
<head>
<style>
div.cities { background-color: black;
color: white;
padding: 20px;}
</style>
</head>
24Computer Network & Web Tech (SET, JU)
DIV: Using class attribute (contd..)
<body>
<div class= ”cities”>
<h2> London </h2>
<p> Capital of UK </p>
</div>
<div class= ”cities”>
<h2>Paris</h2>
<p> Capital of France </p>
</div>
</head>
See h3class.htm 25Computer Network & Web Tech (SET, JU)
Inline Elements
 Do not start on a new line
 Take up as much width as necessary
 Examples
o <span>
o <img>
o <a>
26Computer Network & Web Tech (SET, JU)
SPAN Element
 Grouping element, usually container for some text i.e. defines a
particular section of text inline
 Used with CSS to style parts of content
 No required attributes, often used with <style> & <class>
 Example
<p> This is an <span style==“color:red; font-size:18px;” >
important topic </span> for the subject
</p>
see b2.htm
27Computer Network & Web Tech (SET, JU)
SPAN: Using class attribute
Example
<head>
<style>
span.note { color: red; font-size: 120%;}
</style>
</head>
<body>
<h2> My <span class= ”note”> Important </span> </h2>
<p> This is an <span class= ”note”>
Important </span> text </p>
</body>
b4class.htm
28Computer Network & Web Tech (SET, JU)

Weitere ähnliche Inhalte

Was ist angesagt? (20)

HTML Forms
HTML FormsHTML Forms
HTML Forms
 
html 5 new form attribute
html 5 new form attributehtml 5 new form attribute
html 5 new form attribute
 
Html forms
Html formsHtml forms
Html forms
 
Web engineering - HTML Form
Web engineering -  HTML FormWeb engineering -  HTML Form
Web engineering - HTML Form
 
New Form Element in HTML5
New Form Element in HTML5New Form Element in HTML5
New Form Element in HTML5
 
20 html-forms
20 html-forms20 html-forms
20 html-forms
 
Forms in html5
Forms in html5Forms in html5
Forms in html5
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
Html forms
Html formsHtml forms
Html forms
 
[Basic HTML/CSS] 4. html - form tags
[Basic HTML/CSS] 4. html - form tags[Basic HTML/CSS] 4. html - form tags
[Basic HTML/CSS] 4. html - form tags
 
Html forms
Html formsHtml forms
Html forms
 
Building html forms
Building html formsBuilding html forms
Building 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
 
Html forms
Html formsHtml forms
Html forms
 
Html class-04
Html class-04Html class-04
Html class-04
 
Tut 06 (forms)
Tut 06 (forms)Tut 06 (forms)
Tut 06 (forms)
 
Web topic 20 2 html forms
Web topic 20 2  html formsWeb topic 20 2  html forms
Web topic 20 2 html forms
 
Web topic 20 1 html forms
Web topic 20 1  html formsWeb topic 20 1  html forms
Web topic 20 1 html forms
 
Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)Html 5-tables-forms-frames (1)
Html 5-tables-forms-frames (1)
 
05 html-forms
05 html-forms05 html-forms
05 html-forms
 

Ähnlich wie Html 4 (20)

Designing web pages html forms and input
Designing web pages html  forms and inputDesigning web pages html  forms and input
Designing web pages html forms and input
 
Html form
Html formHtml form
Html form
 
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
 
Chapter09
Chapter09Chapter09
Chapter09
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Html - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik AcademyHtml - Tables, Forms and Frames by Telerik Academy
Html - Tables, Forms and Frames by Telerik Academy
 
Cmsc 100 (web forms)
Cmsc 100 (web forms)Cmsc 100 (web forms)
Cmsc 100 (web forms)
 
Html5ppt
Html5pptHtml5ppt
Html5ppt
 
HTML and CSS part 2
HTML and CSS part 2HTML and CSS part 2
HTML and CSS part 2
 
HTML
HTML HTML
HTML
 
HTML5 New and Improved
HTML5   New and ImprovedHTML5   New and Improved
HTML5 New and Improved
 
Web design - Working with forms in HTML
Web design - Working with forms in HTMLWeb design - Working with forms in HTML
Web design - Working with forms in HTML
 
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
 
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II  Html 5 Tables, Forms and MediaFYBSC IT Web Programming Unit II  Html 5 Tables, Forms and Media
FYBSC IT Web Programming Unit II Html 5 Tables, Forms and Media
 
Unit 2
Unit 2 Unit 2
Unit 2
 
HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.
 
HTML Tables and Forms
HTML Tables and Forms HTML Tables and Forms
HTML Tables and Forms
 
Introduction to Html5
Introduction to Html5Introduction to Html5
Introduction to Html5
 

Mehr von pavishkumarsingh (19)

Xml 2
Xml  2 Xml  2
Xml 2
 
Xml 1
Xml 1Xml 1
Xml 1
 
Javascript 2
Javascript 2Javascript 2
Javascript 2
 
Javascript 1
Javascript 1Javascript 1
Javascript 1
 
Html 5
Html   5Html   5
Html 5
 
Html 4
Html   4Html   4
Html 4
 
Html 3
Html   3Html   3
Html 3
 
Html 2
Html   2Html   2
Html 2
 
Html 1
Html 1Html 1
Html 1
 
Final action script
Final action scriptFinal action script
Final action script
 
Multimedia system
Multimedia systemMultimedia system
Multimedia system
 
Visual basic
Visual basicVisual basic
Visual basic
 
Human - compuTer interaction
Human  -  compuTer interactionHuman  -  compuTer interaction
Human - compuTer interaction
 
Multimedia system(OPEN DOCUMENT ARCHITECTURE AND INTERCHANGING FORMAT)
Multimedia system(OPEN DOCUMENT ARCHITECTURE AND INTERCHANGING FORMAT)Multimedia system(OPEN DOCUMENT ARCHITECTURE AND INTERCHANGING FORMAT)
Multimedia system(OPEN DOCUMENT ARCHITECTURE AND INTERCHANGING FORMAT)
 
Authoring metaphors
Authoring metaphorsAuthoring metaphors
Authoring metaphors
 
Final action script for visual basic
Final action script for visual basicFinal action script for visual basic
Final action script for visual basic
 
Cognitive aspects in human computer interaction
Cognitive aspects in human computer interactionCognitive aspects in human computer interaction
Cognitive aspects in human computer interaction
 
list script and flowchart
list script and flowchartlist script and flowchart
list script and flowchart
 
Networks
Networks   Networks
Networks
 

Kürzlich hochgeladen

High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escortsranjana rawat
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxfenichawla
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...ranjana rawat
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)simmis5
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Call Girls in Nagpur High Profile
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...ranjana rawat
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college projectTonystark477637
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlysanyuktamishra911
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGSIVASHANKAR N
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...ranjana rawat
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...ranjana rawat
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur High Profile
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdfankushspencer015
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Bookingdharasingh5698
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...Call Girls in Nagpur High Profile
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Christo Ananth
 

Kürzlich hochgeladen (20)

Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024Water Industry Process Automation & Control Monthly - April 2024
Water Industry Process Automation & Control Monthly - April 2024
 
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Isha Call 7001035870 Meet With Nagpur Escorts
 
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptxBSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
BSides Seattle 2024 - Stopping Ethan Hunt From Taking Your Data.pptx
 
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
(PRIYA) Rajgurunagar Call Girls Just Call 7001035870 [ Cash on Delivery ] Pun...
 
Roadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and RoutesRoadmap to Membership of RICS - Pathways and Routes
Roadmap to Membership of RICS - Pathways and Routes
 
Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)Java Programming :Event Handling(Types of Events)
Java Programming :Event Handling(Types of Events)
 
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...Top Rated  Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
Top Rated Pune Call Girls Budhwar Peth ⟟ 6297143586 ⟟ Call Me For Genuine Se...
 
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur EscortsCall Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
Call Girls Service Nagpur Tanvi Call 7001035870 Meet With Nagpur Escorts
 
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
The Most Attractive Pune Call Girls Budhwar Peth 8250192130 Will You Miss Thi...
 
result management system report for college project
result management system report for college projectresult management system report for college project
result management system report for college project
 
KubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghlyKubeKraft presentation @CloudNativeHooghly
KubeKraft presentation @CloudNativeHooghly
 
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur EscortsHigh Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
High Profile Call Girls Nagpur Meera Call 7001035870 Meet With Nagpur Escorts
 
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTINGMANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
MANUFACTURING PROCESS-II UNIT-1 THEORY OF METAL CUTTING
 
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
(SHREYA) Chakan Call Girls Just Call 7001035870 [ Cash on Delivery ] Pune Esc...
 
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
The Most Attractive Pune Call Girls Manchar 8250192130 Will You Miss This Cha...
 
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur EscortsCall Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
Call Girls in Nagpur Suman Call 7001035870 Meet With Nagpur Escorts
 
AKTU Computer Networks notes --- Unit 3.pdf
AKTU Computer Networks notes ---  Unit 3.pdfAKTU Computer Networks notes ---  Unit 3.pdf
AKTU Computer Networks notes --- Unit 3.pdf
 
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 BookingVIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
VIP Call Girls Ankleshwar 7001035870 Whatsapp Number, 24/07 Booking
 
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...Booking open Available Pune Call Girls Koregaon Park  6297143586 Call Hot Ind...
Booking open Available Pune Call Girls Koregaon Park 6297143586 Call Hot Ind...
 
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
Call for Papers - African Journal of Biological Sciences, E-ISSN: 2663-2187, ...
 

Html 4

  • 2. HTML Forms  HTML Forms used to collect user input  <form> element defines an HTML form <form> . form elements . </form>  An HTML form contains form elements  Different types of input elements, like text fields, checkboxes, radio buttons, submit buttons, and more First name: Last name: 2Computer Network & Web Tech (SET, JU) Bose
  • 3. Form Attributes Element Description action Specifies an address (url) where to submit the form (default) autocomplete Specifies if the browser should autocomplete the form (default: on). enctype Specifies the encoding of the submitted data (default: is url-encoded). method Specifies the HTTP method used when submitting the data name Used to identify the form novalidate Specifies that the browser should not validate the form. target Specifies the target of the address in the action attribute 3Computer Network & Web Tech (SET, JU)
  • 4. Form Attributes (contd..) <form action="/action_page.php" novalidate method=“get”> E mail: <input type="email" name="user_email”> <input type="submit” formtarget="_blank” value="Submit to a new window"> <input type="submit" formaction="/action_page2.php” value="Submit as admin"> </form> (see 1a.htm, 1b.htm) 4Computer Network & Web Tech (SET, JU)
  • 5. Method Attribute  Default method when submitting form data is GET  When GET is used, the submitted form data will be visible in the page address field action_page.php?firstname=Mickey&lastname=Mouse  Suited for short, insensitive information  When POST is used, submitted data is part of body, not visible in page address field  Used for sensitive information  POST has no size limitations, can be used to send large amounts of data 5Computer Network & Web Tech (SET, JU)
  • 6. Input Element  <input> - most important form element  Can be displayed in different ways depending on type attribute Type Description <input type="text"> Defines a one-line text input field <input type="radio"> Defines a radio button (for selecting one of many choices) <input type="submit"> Defines a submit button (for submitting the form) 6Computer Network & Web Tech (SET, JU)
  • 7. Text Input  <input> - most important form element  Can be displayed in different ways depending on type attribute • Attributes Readonly, disabled, maxlength, size, required, autofocus, autocomplete, placeholder, pattern, title, max, min, step  Default width of a text field is 20 characters. (see 1.htm) <form> First name:<br> <input type="text" name="firstname” value=“Arnab” size=20> <br> Last name:<br> <input type="text" name="lastname” value=“Bose” size=30 > </form> 7Computer Network & Web Tech (SET, JU)
  • 8. Text Input (contd..) <form autocomplete=“on”> First name: <input type="text" name="firstname”> <br> Last name: <input type="text" name="lastname”> <br> Email: <input type="text" name=“email” autocomplete=“off”> <br> Country Code: <input type="text" name=“cntrycode” pattern=“[A-Za-z]{3} title="Three letter country code”> </form> 8Computer Network & Web Tech (SET, JU)
  • 9. Password <input type=“password”> <form> First name: <input type="text" name="firstname”> <br> Last name: <input type="text" name="lastname”> <br> Password: <input type=“password" name=“psw”> <br> </form> 9Computer Network & Web Tech (SET, JU)
  • 10. Submit Button <input type=“submit”>  Defines a button for submitting form data to a form handler o Typically a server page with a script for processing the data o Specified in the form's action attribute o If action attribute omitted, handled by the same page  If value for type “submit” element omitted, default text <form action=“/action_page.php”> First name: <input type="text" name="firstname”> <br> Last name: <input type="text" name="lastname”> <br> <input type=“submit" value=“submit”> <br> </form> 10Computer Network & Web Tech (SET, JU)
  • 11. Reset Button <input type=“reset”>  Defines a reset button o Will reset all form values to their default values <form action=“/action_page.php”> First name: <input type="text" name="firstname”> <br> Last name: <input type="text" name="lastname”> <br> <input type=“submit" value=“submit”> <br> <input type=“reset" > </form> 11Computer Network & Web Tech (SET, JU)
  • 12. Radio Buttons <input type=“radio”>  Defines a radio button o lets a user select ONLY ONE out of a limited number of choices <form action=“/action_page.php”> <input type="radio" name="gender" value="male" checked> Male<br> <input type="radio" name="gender" value="female"> Female<br> <input type="radio" name="gender" value="other"> Other </form> 12Computer Network & Web Tech (SET, JU)
  • 13. Checkbox <input type=“checkbox”>  Defines a checkbox o Checkboxes let a user select ZERO or MORE options of a limited number of choices <form action=“/action_page.php”> <input type="checkbox" name="vhcl1" value="Bike"> I have a bike<br> <input type="checkbox" name="vhcl2" value="Car"> I have a car </form> see 2.htm 13Computer Network & Web Tech (SET, JU)
  • 14. Button <input type=“button”>  Defines a clickable button <form action=“/action_page.php”> First name: <input type="text" name="firstname”> <br> Last name: <input type="text" name="lastname”> <br> <input type=“button“ onclick="alert('Hello World!')" value="Click Me!"> </form> 14Computer Network & Web Tech (SET, JU)
  • 15. Addition input types – HTML5  When not supported by older browsers, act as text o number, color, date, month,week, range, email, URL <input type=“number" name=“qty” min=“0” name=“100” step=“10” > <input type=“range" name=“points” min=“0” name=“100” step=“2” value=“50” > <input type="email" name="email"> <input type=“URL" name=“homepage"> 15Computer Network & Web Tech (SET, JU)
  • 16. HTML5 input types (contd..) Depending on browser support, a date or time picker can show up in the input field Enter a date before 1980-01-01: <input type="date" name="bday" max="1979-12-31"> Enter a date after 2000-01-01: <input type="datetime-local" name="bday" min="2000-01- 02"> <input type="month" name="bdaymonth“ > <input type="week" name="week_year"> <input type="time" name="usr_time"> <input type="color" name="favcolor"> See 3.htm 16Computer Network & Web Tech (SET, JU)
  • 17. Select Element <select>  Defines a dropdown list o <option> elements defines an option that can be selected o By default, the first item in the drop-down list is selected. o To define a pre-selected option, add selected attribute to option <select name=“cars”> <option value=“audi”> Audi </option> <option value=“mercedes” selected> Mercedes </option> <option value=“bmw”> BMW </option> <select name=“cars”> </form> 17Computer Network & Web Tech (SET, JU)
  • 18. DataList Element <datalist>  Defines a dropdown list for an input element (new in HTML5) o Users will see drop-down list of pre-defined options as they input data o list attribute of <input> element must refer id attribute of <datalist> <input list=“browsers”> <datalist id=“browsers”> <option value=“firefox”> Firefox </option> <option value=“chrome”> chrome </option> <option value=“ie”> Internet Explorer</option> < /datalist> 18Computer Network & Web Tech (SET, JU)
  • 19. Textarea Element <textarea>  Defines a multiline input field o rows and columns can be defined o row attribute defines number of visible lines o col attribute defines visible width <textarea name=“message” rows=“10” cols=“30” > The fox jumped over the fence </textarea> See 4.htm 19Computer Network & Web Tech (SET, JU)
  • 20. Some more Elements.. Element Description <label> Defines a label for an <input> element <fieldset> Groups related elements in a form <optgroup> Defines a group of related options in a drop- down list <output> Defines the result of a calculation 20Computer Network & Web Tech (SET, JU)
  • 21. Block & Inline Elements Grouping Elements (DIV,SPAN) 21Computer Network & Web Tech (SET, JU)
  • 22. Block Element  Start on a new line & take full available width  Examples o <h1> to <h6> o <p> o <div> o <form> 22Computer Network & Web Tech (SET, JU)
  • 23. Div Element  Grouping element, generally used to style a block of content  Often used as container for other elements  No required attributes, often used with <style> & <class>  Example <div style==“backgroundcolor:black; color:white; padding:20px;” > <h2> London </h2> <p> Capital of UK </p> </div> See h1.htm 23Computer Network & Web Tech (SET, JU)
  • 24. DIV: Using class attribute Makes it easier to define equal styles for elements with same class Example <head> <style> div.cities { background-color: black; color: white; padding: 20px;} </style> </head> 24Computer Network & Web Tech (SET, JU)
  • 25. DIV: Using class attribute (contd..) <body> <div class= ”cities”> <h2> London </h2> <p> Capital of UK </p> </div> <div class= ”cities”> <h2>Paris</h2> <p> Capital of France </p> </div> </head> See h3class.htm 25Computer Network & Web Tech (SET, JU)
  • 26. Inline Elements  Do not start on a new line  Take up as much width as necessary  Examples o <span> o <img> o <a> 26Computer Network & Web Tech (SET, JU)
  • 27. SPAN Element  Grouping element, usually container for some text i.e. defines a particular section of text inline  Used with CSS to style parts of content  No required attributes, often used with <style> & <class>  Example <p> This is an <span style==“color:red; font-size:18px;” > important topic </span> for the subject </p> see b2.htm 27Computer Network & Web Tech (SET, JU)
  • 28. SPAN: Using class attribute Example <head> <style> span.note { color: red; font-size: 120%;} </style> </head> <body> <h2> My <span class= ”note”> Important </span> </h2> <p> This is an <span class= ”note”> Important </span> text </p> </body> b4class.htm 28Computer Network & Web Tech (SET, JU)

Hinweis der Redaktion

  1. When autocomplete is on, the browser automatically completes the input values based on values that the user has entered before.
  2. The value attribute specifies the initial value for an input field: readonly attribute specifies that the input field is read only (cannot be changed) disabled attribute specifies that the input field is disabled A disabled input field is unusable and un-clickable, and its value will not be sent when submitting the form The size attribute specifies the size (in characters) for the input field: pattern attribute works with the following input types: text, search, url, tel, email, and password