SlideShare a Scribd company logo
1 of 36
XP
A Seminar
on
Creating Web Forms
XP
Form Components and Elements
First Name
Address #1
Address #2
City
Last Name
Country
State Zip
Item Purchased Purchase Date
Home
Business
Government
Educational Institution
Netware
Banyan Vines
Windows
IBM Lan Server
Comments?:
Send RegistrationSend Registration
Cancel
Cancel
Serial Number
Used For (check one) Network Operating System (check all that apply)
Religious or Charitable Institution
PC/NFS
Input box
drop-down list box
radio buttons
check boxes
text area
form button
group box
XP
Form Control Elements
• Control elements :
– text boxes for text and numerical entries
– selection lists for long lists of options, usually appearing in a
drop-down list box
– radio buttons, also called option buttons, to select a single
option from a predefined list
– check boxes to specify an item as either present or absent
– groups boxes to organize form elements
– text areas for extended entries that can include several lines
of text
– buttons that can be clicked to start processing the form
• Each control element in which the user can enter information is called
a field.
XP
The <form> Tag
• A single page can include several different forms, but you
cannot nest one form inside another.
• The general syntax of the <form> tag is:
<form attributes>
form elements and layout tags
</form>
• A single Web page can contain multiple forms, the
<form> tag includes the name attribute.
• The name attribute identifies each form on the page.
• The name attribute is also needed for programs that
retrieve values from the form.
XP
Input Types
Type Description
type=”button” Display a button which can be clicked to
perform an action from a script
type=”checkbox” Display a check box
type=”file” Display a browse button to locate and select a
file
type=”hidden” Create a hidden field, not viewable on the form
type=”image” Display an inline image which can be clicked to
perform an action from a script
type=”password” Display a text box in which hides text entered
by the user
type=”radio” Display a radio (option) button
type=”reset” Display a button which resets the form when
clicked
type=”submit” Display a button which submits the form when
clicked
type=”text” Display a text box in which displays text
entered by the user
XP
Working with Text Boxes
• Text boxes are created using the <input> tag.
• The general syntax is:
<input type=“type” name=“name”
id=“id”>
– type specifies the type of input field
– name and id attributes identifies the input field for
the CGI script
• To create a text box, you would enter the tag:
<input type=“text”>
XP
Creating a Text Box
• To create a text box, use the following HTML code:
<input name=“name” id=“id” value=“value”
size=“value” maxlength=“value”>
– name and id attributes identify the field
– value - a default value to the text box
– size - the width of the text box in number of characters
– maxlength - the maximum number of characters allowed
in the field
XP
Setting the Width of Text Boxes
XP
Specify the Maximum Length
for a Field
no more than 5 characters are allowed in this text box
This figure shows an example of limiting the width of the zip code field to five characters.
XP
Setting a Default Value for a Field
• When the same value is entered into a field, it may
make sense to define a default value for a field.
• Default values can save time and increase
accuracy for users of a Web site.
• To define a default value, use the following
syntax:
<input value=“default value”>
– value is the default text or number that is displayed in
the field
XP
Defining a Default Value for a Field
default value
If customers from countries other than the United States use this Web form,
they can remove the default value by selecting the text and pressing the Delete key.
XP
Value =“United States”
XP
Creating a Password Field
• A password field is a text box in which the characters
typed by the user are displayed as bullets or asterisks i.e.
****.
• The syntax for creating a Password field is:
<input type=“password”>
• Using a password field should not be confused with having
a secure connection.
• The password itself is not encrypted.
• The password field only acts as a mask for a field entry as
it is entered.
XP
Creating a Selection List
• A selection list is a list box from which a user selects a
particular value or set of values.
• Selection lists are good to use when there is a fixed set of
possible responses.
• Selection lists help prevent spelling mistakes and
erroneous entries.
• A selection list is created using the <select> tag.
• The <option> tag is used to specify individual selection
items.
XP
Creating a Selection List
items in the selection list
selection list field name
XP
Selection Lists with
Different Size Values
size = "1" size = "4"
size = "7" size = "9"
XP
Working with Option Groups
• The most recent releases of HTML allows you to
organize selection lists into distinct groups called
option groups.
• The syntax for creating an option group is:
<optgroup label=“label”>
– label is the label assigned to the option group
– the text for the label appears in the selection list above
each group of items but is not a selectable item from
the list
XP
Option Groups
a single option group
option group label
a single option group
option group label
Internet Explorer and Netscape versions prior to 6.0 display
the selection list without the group labels.
XP
Radio Buttons
• Radio buttons display a list of choices from which a user
makes a selection.
– Only one radio button can be selected at a time.
• The syntax to create a radio button is:
<input type=“radio” name=“name” id=“id”
value=“value”>
– name - the field containing the radio button (required)
– id - the specific option. Only required if you intend to use a
field label with the radio button
– value - the value sent to the CGI script, if that radio button is
selected by the user
XP
Creating Radio Buttons
In this sample code, the value sent to the CGI script does not match the field label.
If the user selects the Republican radio button, the value “gop”
is sent to the CGI script paired with the field name “party.”
XP
Creating a Group Box
• A group box labels an entire collection of radio
buttons.
• A group box is a box placed around a set of fields
that indicates that they belong to a common group.
• The syntax for creating a group box is:
<fieldset>
<legend align=“align”>legend
text</legend>
collection of fields
</fieldset>
XP
Group Boxes for Radio Buttons
and Check Boxes
XP
Creating a Field Set
• HTML and XHML allow you to organize option
buttons into a group of fields called field sets.
– Most browsers place a group box around a field set to
indicate that the fields belong to a common group.
<fieldset>
fields
</fieldset>
Where fields are the individual fields within a set.
• the <legend> tag is used to display a legend on the
group box
XP
Creating a Group Box and Legend
start of group box
group box legend
resulting radio buttons and group box
XP
Working with Check Boxes
• A check box is either selected or not
• Check boxes are created using the following syntax:
<input type=“checkbox” name=“name”
id=“id” value=“value”>
– name and id - the check box
– the value - the value that is sent to the CGI script when
the check box is selected
• Check boxes are not selected by default.
– to do this, add the checked attribute to the <input> tag
– <input type =“checkbox” checked = “checked”>
XP
Group Boxes for Radio Buttons
and Check Boxes
XP
Creating a Text Area
resulting text area
dimensions of text
area
default text area text
XP
Creating a Form Button
XP
Creating a Push Button
• One type of button, called a push button, is
created using the <input> tag as follows:
<input type=“button” value=“text”>
– text is the text that appears on the button
• By themselves, push buttons perform no actions in
the Web page.
• To create an action, write a script or program that
runs automatically when the button is clicked.
XP
Creating Submit and Reset Buttons
• A submit button is a button that submits the form
to the CGI script for processing.
• A reset button resets the form to its original
(default) values.
• The syntax for creating these two buttons is:
<input type=“submit” value=“text”>
<input type=“reset” value=“text”>
– value attribute defines the text that appears on the
button
XP
Creating a Form Button
The figure shows HTML tags for buttons that download a program,
retrieves information, and resets the form to its original values.
XP
Creating a File Button
1. User clicks the Browse button
2. Selects a file from the
Choose File dialog box
3. The filename and location
are automatically placed in
the text box
The figure shows
an example of
using the file
button to return
the location of a
file named
“report.doc.”
XP
Working with Form Attributes
• After adding the elements to your form, you’ll need to specify
where to send the form data and how to send it. Use the
following attributes:
<form action=“url”method=“type”enctype=“type”>… </form>
– URL - the filename and location of the CGI script that process the form
– Method - how your Web browser sends data to the CGI script
– enctype - the format of the data stored in the form’s field
XP
Working with Form Attributes
• The method attribute can have one of two values:
– Post
– Get
• The get method is the default;
– get appends the form data to the end of the URL specified in the
action attribute.
• The post method sends form data in a separate data stream,
allowing the Web server to receive the data through “standard
input”.
– the “post” method is considered the preferred way of sending data to
a Web server
XP
Specifying Where and How
to Send Form Data
XP

More Related Content

What's hot

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 inputJesus Obenita Jr.
 
Database Management System - SQL Advanced Training
Database Management System - SQL Advanced TrainingDatabase Management System - SQL Advanced Training
Database Management System - SQL Advanced TrainingMoutasm Tamimi
 
Creating a quiz using visual basic 6
Creating a quiz using visual basic 6Creating a quiz using visual basic 6
Creating a quiz using visual basic 6Ella Marie Wico
 
Computer homework
Computer homeworkComputer homework
Computer homeworkadarsh-kaul
 
[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 tagsHyejin Oh
 
Forms with html5 (1)
Forms with html5 (1)Forms with html5 (1)
Forms with html5 (1)Anada Kale
 
Database Management System - SQL beginner Training
Database Management System - SQL beginner Training Database Management System - SQL beginner Training
Database Management System - SQL beginner Training Moutasm Tamimi
 
Notes windows form controls gui applications
Notes windows form controls   gui applicationsNotes windows form controls   gui applications
Notes windows form controls gui applicationsWilliam Olivier
 
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
 
Chapter 2 class power point
Chapter 2 class power pointChapter 2 class power point
Chapter 2 class power pointcmurphysvhs
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training Moutasm Tamimi
 
HTML-5 New Input Types
HTML-5 New Input TypesHTML-5 New Input Types
HTML-5 New Input TypesMinhas Kamal
 

What's hot (19)

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 forms
Html formsHtml forms
Html forms
 
Database Management System - SQL Advanced Training
Database Management System - SQL Advanced TrainingDatabase Management System - SQL Advanced Training
Database Management System - SQL Advanced Training
 
Creating a quiz using visual basic 6
Creating a quiz using visual basic 6Creating a quiz using visual basic 6
Creating a quiz using visual basic 6
 
Computer homework
Computer homeworkComputer homework
Computer homework
 
[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
 
Forms with html5 (1)
Forms with html5 (1)Forms with html5 (1)
Forms with html5 (1)
 
Database Management System - SQL beginner Training
Database Management System - SQL beginner Training Database Management System - SQL beginner Training
Database Management System - SQL beginner Training
 
Notes windows form controls gui applications
Notes windows form controls   gui applicationsNotes windows form controls   gui applications
Notes windows form controls gui applications
 
Html 4
Html   4Html   4
Html 4
 
Vb 6.0 controls
Vb 6.0 controlsVb 6.0 controls
Vb 6.0 controls
 
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
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Chapter 2 class power point
Chapter 2 class power pointChapter 2 class power point
Chapter 2 class power point
 
Windows form application - C# Training
Windows form application - C# Training Windows form application - C# Training
Windows form application - C# Training
 
HTML-5 New Input Types
HTML-5 New Input TypesHTML-5 New Input Types
HTML-5 New Input Types
 
4.C#
4.C#4.C#
4.C#
 
Maliram poonia project
Maliram poonia projectMaliram poonia project
Maliram poonia project
 
INPUT BOX- VBA
INPUT BOX- VBAINPUT BOX- VBA
INPUT BOX- VBA
 

Similar to Creating web form(For College Seminars) (20)

3. HTML Forms.ppt
3. HTML Forms.ppt3. HTML Forms.ppt
3. HTML Forms.ppt
 
Forms Part 1
Forms Part 1Forms Part 1
Forms Part 1
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Html4
Html4Html4
Html4
 
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZerStd 12 Computer Chapter 1 Creating Html Forms Using KompoZer
Std 12 Computer Chapter 1 Creating Html Forms Using KompoZer
 
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 forms
Html formsHtml forms
Html forms
 
Chapter 9: Forms
Chapter 9: FormsChapter 9: Forms
Chapter 9: Forms
 
Html4
Html4Html4
Html4
 
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
 
Tut 06 (forms)
Tut 06 (forms)Tut 06 (forms)
Tut 06 (forms)
 
Html,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tagsHtml,Css and Javascript Forms using different tags
Html,Css and Javascript Forms using different tags
 
Tm 1st quarter - 2nd meeting
Tm   1st quarter - 2nd meetingTm   1st quarter - 2nd meeting
Tm 1st quarter - 2nd meeting
 
Html Forms.ppt
Html Forms.pptHtml Forms.ppt
Html Forms.ppt
 
Html Form Controls
Html Form ControlsHtml Form Controls
Html Form Controls
 
Cmsc 100 (web forms)
Cmsc 100 (web forms)Cmsc 100 (web forms)
Cmsc 100 (web forms)
 
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
 
Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017Prep 2-booklet-2nd-term-2016-2017
Prep 2-booklet-2nd-term-2016-2017
 
002.table
002.table002.table
002.table
 

Recently uploaded

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsAndrey Dotsenko
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupFlorian Wilhelm
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...Fwdays
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Wonjun Hwang
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr LapshynFwdays
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsHyundai Motor Group
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Patryk Bandurski
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationSlibray Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationSafe Software
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Enterprise Knowledge
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationRidwan Fadjar
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Mattias Andersson
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Scott Keck-Warren
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersThousandEyes
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024BookNet Canada
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machinePadma Pradeep
 

Recently uploaded (20)

Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmaticsKotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
Kotlin Multiplatform & Compose Multiplatform - Starter kit for pragmatics
 
Streamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project SetupStreamlining Python Development: A Guide to a Modern Project Setup
Streamlining Python Development: A Guide to a Modern Project Setup
 
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks..."LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
"LLMs for Python Engineers: Advanced Data Analysis and Semantic Kernel",Oleks...
 
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
Bun (KitWorks Team Study 노별마루 발표 2024.4.22)
 
Pigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food ManufacturingPigging Solutions in Pet Food Manufacturing
Pigging Solutions in Pet Food Manufacturing
 
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
"Federated learning: out of reach no matter how close",Oleksandr Lapshyn
 
DMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special EditionDMCC Future of Trade Web3 - Special Edition
DMCC Future of Trade Web3 - Special Edition
 
The transition to renewables in India.pdf
The transition to renewables in India.pdfThe transition to renewables in India.pdf
The transition to renewables in India.pdf
 
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter RoadsSnow Chain-Integrated Tire for a Safe Drive on Winter Roads
Snow Chain-Integrated Tire for a Safe Drive on Winter Roads
 
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptxE-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
E-Vehicle_Hacking_by_Parul Sharma_null_owasp.pptx
 
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
Integration and Automation in Practice: CI/CD in Mule Integration and Automat...
 
Connect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck PresentationConnect Wave/ connectwave Pitch Deck Presentation
Connect Wave/ connectwave Pitch Deck Presentation
 
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry InnovationBeyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
Beyond Boundaries: Leveraging No-Code Solutions for Industry Innovation
 
Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024Designing IA for AI - Information Architecture Conference 2024
Designing IA for AI - Information Architecture Conference 2024
 
My Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 PresentationMy Hashitalk Indonesia April 2024 Presentation
My Hashitalk Indonesia April 2024 Presentation
 
Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?Are Multi-Cloud and Serverless Good or Bad?
Are Multi-Cloud and Serverless Good or Bad?
 
Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024Advanced Test Driven-Development @ php[tek] 2024
Advanced Test Driven-Development @ php[tek] 2024
 
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for PartnersEnhancing Worker Digital Experience: A Hands-on Workshop for Partners
Enhancing Worker Digital Experience: A Hands-on Workshop for Partners
 
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
#StandardsGoals for 2024: What’s new for BISAC - Tech Forum 2024
 
Install Stable Diffusion in windows machine
Install Stable Diffusion in windows machineInstall Stable Diffusion in windows machine
Install Stable Diffusion in windows machine
 

Creating web form(For College Seminars)

  • 2. XP Form Components and Elements First Name Address #1 Address #2 City Last Name Country State Zip Item Purchased Purchase Date Home Business Government Educational Institution Netware Banyan Vines Windows IBM Lan Server Comments?: Send RegistrationSend Registration Cancel Cancel Serial Number Used For (check one) Network Operating System (check all that apply) Religious or Charitable Institution PC/NFS Input box drop-down list box radio buttons check boxes text area form button group box
  • 3. XP Form Control Elements • Control elements : – text boxes for text and numerical entries – selection lists for long lists of options, usually appearing in a drop-down list box – radio buttons, also called option buttons, to select a single option from a predefined list – check boxes to specify an item as either present or absent – groups boxes to organize form elements – text areas for extended entries that can include several lines of text – buttons that can be clicked to start processing the form • Each control element in which the user can enter information is called a field.
  • 4. XP The <form> Tag • A single page can include several different forms, but you cannot nest one form inside another. • The general syntax of the <form> tag is: <form attributes> form elements and layout tags </form> • A single Web page can contain multiple forms, the <form> tag includes the name attribute. • The name attribute identifies each form on the page. • The name attribute is also needed for programs that retrieve values from the form.
  • 5. XP Input Types Type Description type=”button” Display a button which can be clicked to perform an action from a script type=”checkbox” Display a check box type=”file” Display a browse button to locate and select a file type=”hidden” Create a hidden field, not viewable on the form type=”image” Display an inline image which can be clicked to perform an action from a script type=”password” Display a text box in which hides text entered by the user type=”radio” Display a radio (option) button type=”reset” Display a button which resets the form when clicked type=”submit” Display a button which submits the form when clicked type=”text” Display a text box in which displays text entered by the user
  • 6. XP Working with Text Boxes • Text boxes are created using the <input> tag. • The general syntax is: <input type=“type” name=“name” id=“id”> – type specifies the type of input field – name and id attributes identifies the input field for the CGI script • To create a text box, you would enter the tag: <input type=“text”>
  • 7. XP Creating a Text Box • To create a text box, use the following HTML code: <input name=“name” id=“id” value=“value” size=“value” maxlength=“value”> – name and id attributes identify the field – value - a default value to the text box – size - the width of the text box in number of characters – maxlength - the maximum number of characters allowed in the field
  • 8. XP Setting the Width of Text Boxes
  • 9. XP Specify the Maximum Length for a Field no more than 5 characters are allowed in this text box This figure shows an example of limiting the width of the zip code field to five characters.
  • 10. XP Setting a Default Value for a Field • When the same value is entered into a field, it may make sense to define a default value for a field. • Default values can save time and increase accuracy for users of a Web site. • To define a default value, use the following syntax: <input value=“default value”> – value is the default text or number that is displayed in the field
  • 11. XP Defining a Default Value for a Field default value If customers from countries other than the United States use this Web form, they can remove the default value by selecting the text and pressing the Delete key.
  • 13. XP Creating a Password Field • A password field is a text box in which the characters typed by the user are displayed as bullets or asterisks i.e. ****. • The syntax for creating a Password field is: <input type=“password”> • Using a password field should not be confused with having a secure connection. • The password itself is not encrypted. • The password field only acts as a mask for a field entry as it is entered.
  • 14. XP Creating a Selection List • A selection list is a list box from which a user selects a particular value or set of values. • Selection lists are good to use when there is a fixed set of possible responses. • Selection lists help prevent spelling mistakes and erroneous entries. • A selection list is created using the <select> tag. • The <option> tag is used to specify individual selection items.
  • 15. XP Creating a Selection List items in the selection list selection list field name
  • 16. XP Selection Lists with Different Size Values size = "1" size = "4" size = "7" size = "9"
  • 17. XP Working with Option Groups • The most recent releases of HTML allows you to organize selection lists into distinct groups called option groups. • The syntax for creating an option group is: <optgroup label=“label”> – label is the label assigned to the option group – the text for the label appears in the selection list above each group of items but is not a selectable item from the list
  • 18. XP Option Groups a single option group option group label a single option group option group label Internet Explorer and Netscape versions prior to 6.0 display the selection list without the group labels.
  • 19. XP Radio Buttons • Radio buttons display a list of choices from which a user makes a selection. – Only one radio button can be selected at a time. • The syntax to create a radio button is: <input type=“radio” name=“name” id=“id” value=“value”> – name - the field containing the radio button (required) – id - the specific option. Only required if you intend to use a field label with the radio button – value - the value sent to the CGI script, if that radio button is selected by the user
  • 20. XP Creating Radio Buttons In this sample code, the value sent to the CGI script does not match the field label. If the user selects the Republican radio button, the value “gop” is sent to the CGI script paired with the field name “party.”
  • 21. XP Creating a Group Box • A group box labels an entire collection of radio buttons. • A group box is a box placed around a set of fields that indicates that they belong to a common group. • The syntax for creating a group box is: <fieldset> <legend align=“align”>legend text</legend> collection of fields </fieldset>
  • 22. XP Group Boxes for Radio Buttons and Check Boxes
  • 23. XP Creating a Field Set • HTML and XHML allow you to organize option buttons into a group of fields called field sets. – Most browsers place a group box around a field set to indicate that the fields belong to a common group. <fieldset> fields </fieldset> Where fields are the individual fields within a set. • the <legend> tag is used to display a legend on the group box
  • 24. XP Creating a Group Box and Legend start of group box group box legend resulting radio buttons and group box
  • 25. XP Working with Check Boxes • A check box is either selected or not • Check boxes are created using the following syntax: <input type=“checkbox” name=“name” id=“id” value=“value”> – name and id - the check box – the value - the value that is sent to the CGI script when the check box is selected • Check boxes are not selected by default. – to do this, add the checked attribute to the <input> tag – <input type =“checkbox” checked = “checked”>
  • 26. XP Group Boxes for Radio Buttons and Check Boxes
  • 27. XP Creating a Text Area resulting text area dimensions of text area default text area text
  • 29. XP Creating a Push Button • One type of button, called a push button, is created using the <input> tag as follows: <input type=“button” value=“text”> – text is the text that appears on the button • By themselves, push buttons perform no actions in the Web page. • To create an action, write a script or program that runs automatically when the button is clicked.
  • 30. XP Creating Submit and Reset Buttons • A submit button is a button that submits the form to the CGI script for processing. • A reset button resets the form to its original (default) values. • The syntax for creating these two buttons is: <input type=“submit” value=“text”> <input type=“reset” value=“text”> – value attribute defines the text that appears on the button
  • 31. XP Creating a Form Button The figure shows HTML tags for buttons that download a program, retrieves information, and resets the form to its original values.
  • 32. XP Creating a File Button 1. User clicks the Browse button 2. Selects a file from the Choose File dialog box 3. The filename and location are automatically placed in the text box The figure shows an example of using the file button to return the location of a file named “report.doc.”
  • 33. XP Working with Form Attributes • After adding the elements to your form, you’ll need to specify where to send the form data and how to send it. Use the following attributes: <form action=“url”method=“type”enctype=“type”>… </form> – URL - the filename and location of the CGI script that process the form – Method - how your Web browser sends data to the CGI script – enctype - the format of the data stored in the form’s field
  • 34. XP Working with Form Attributes • The method attribute can have one of two values: – Post – Get • The get method is the default; – get appends the form data to the end of the URL specified in the action attribute. • The post method sends form data in a separate data stream, allowing the Web server to receive the data through “standard input”. – the “post” method is considered the preferred way of sending data to a Web server
  • 35. XP Specifying Where and How to Send Form Data
  • 36. XP