SlideShare uma empresa Scribd logo
1 de 39
Tutorial 6 Working with Web Forms
Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create input boxes and form labels Creation option buttons Create selection lists Create check boxes New Perspectives on HTML and XHTML, Comprehensive
Objectives Create text area boxes Apply styles to Web forms Work with form buttons Explore image elements and hidden fields Work with form actions and methods New Perspectives on HTML and XHTML, Comprehensive
Introducing Web Forms Web forms collect information from Web site visitors.   Web forms include different control elements including: Input boxes Option buttons or radio buttons Selection lists Drop-down lists boxes Check boxes Text areas New Perspectives on HTML and XHTML, Comprehensive
Forms and Server-Based Programs While HTML supports the creation of forms, it does not include tools to process the information. The information can be processed through a program running on a Web server. New Perspectives on HTML and XHTML, Comprehensive
Forms and Server-Based Programs Server-based programs are written in many languages The earliest and most commonly used are Common Gateway Interface (CGI) scripts that are written in Perl. Other popular languages include: ASP ColdFusion C/C++ PHP VBScript New Perspectives on HTML and XHTML, Comprehensive
Creating a Web Form Forms are created using the form element, structured as follows: 	<form attributes> elements 	</form> Where attributesare the attributes that control  how the form is processed and elements are elements places within the form. New Perspectives on HTML and XHTML, Comprehensive
Creating a Web Form Form attributes usually tell the browser the location of the server-based program to be applied to the form’s data. Always specify an id or name for the form. Two attributes are available to identify the form: id and name.   New Perspectives on HTML and XHTML, Comprehensive
Creating a Web Form The syntax of the id and name attributes are as follows: <form name=“name”  id=“id”>… </form> Where name is the name of the form and id is the id of  the form. New Perspectives on HTML and XHTML, Comprehensive
Creating a Field Set HTML and XHTML allow you to organize option buttons into a group of fields called field sets.   	<fieldset id=“id”> 		controls 	</fieldset> 	where id identifies the field set and controls are the control elements associated with fields within the field set New Perspectives on HTML and XHTML, Comprehensive
Creating a Field Set To add a caption to a field set, add the following tag after the opening <fieldset> tag: <legend>text</legend> Where text is the text of the field set caption. New Perspectives on HTML and XHTML, Comprehensive
Creating Input Boxes The general syntax of input elements is as follows:<input type=“type” name=“name” id=“id” /> Where type specifies the type of input control,  and the name and id attributes provide the control’s name and id. New Perspectives on HTML and XHTML, Comprehensive
Creating Input Boxes New Perspectives on HTML and XHTML, Comprehensive
Working with Field Labels You can also expressly link a label with an associated text element for scripting purposes. The syntax for creating a form label is as follows: <label for=“id”>label text</label> 	Where id is the value of the id attribute for a field’s control element, and label text is the text of the label. New Perspectives on HTML and XHTML, Comprehensive
Setting the Width of an Input Box To change the width of an input box, use the width attribute, which is displayed as follows: #id		{width: value} 	Where id is the id of the control and value is the width you want to apply to the input box New Perspectives on HTML and XHTML, Comprehensive
Setting the Width of an Input Box New Perspectives on HTML and XHTML, Comprehensive
Creating Option Buttons New Perspectives on HTML and XHTML, Comprehensive Option buttons, or radio buttons allow users to make selections.   Unlike selection lists, option buttons only allow the user to select one option at a time.
Creating a Group of Option Buttons New Perspectives on HTML and XHTML, Comprehensive To create a group of option buttons associated with a single field, add the elements: <input type="radio" name="name" id="id1" value="value1" /> 	<input type="radio" name="name" id="id2" value="value2" /> 	<input type="radio" name="name" id="id3" value="value3" /> 	to the Web form, where name identifies the field associated with the collection of optionbuttons; id1, id2, id3, etc. identify the specific options; and value1, value2, value3, etc.are the field values associated with each option. To specify the default option, add the following attribute to the <input> tag: 	checked="checked"
Creating a Selection List A selection list is a list box from which a user selects a particular field value or set of field values.   Selection lists are useful when there are a fixed set of possible responses from the user. You can create a selection list using the <select> element. You can specify each individual selection item using the <option> element. New Perspectives on HTML and XHTML, Comprehensive
Setting the Selection List Size You can change the number of options displayed in the selection list by modifying the size attribute. The syntax is as follows: <select size= “value”>… </select> 	Where value is the number of items that the selection list displays in the form. New Perspectives on HTML and XHTML, Comprehensive
Setting the Selection List Size New Perspectives on HTML and XHTML, Comprehensive
Making Multiple Selections Add the multiple attribute to the select element to create multiple selections: <select multiple=“multiple”>… </select> New Perspectives on HTML and XHTML, Comprehensive
Working with Check Boxes To create a check box, use: <input type=“checkbox” name=“name” id=“id” value=“value” /> Where the name and id attributes identify the check box controls and  the value attribute specifies the value sent to the server if the check box is selected. To specify that a check box be selected by default, use the checked attribute as follows: <input type=“checkbox” checked=“checked” /> New Perspectives on HTML and XHTML, Comprehensive
Specifying the Tab Order Users typically navigate through a form with the tab key. You can specify an alternate tab order by adding the tabindex attribute to any control element in your form. The syntax is as follows: <input name=“fname” id=“firstName” tabindex=“1” /> 	This syntax assigns the tab index number “1” to the fname field from the registration form. New Perspectives on HTML and XHTML, Comprehensive
Working with Text Area Control Text area boxes allow users to enter comments. An input box would be too small to accommodate the length of text for this use. New Perspectives on HTML and XHTML, Comprehensive
Working with Text Area Control To create a text area box, use the textarea element: 	<textarea rows="value" cols="value"> ... </textarea> Where the rows and cols attributes define the dimensions of the input box and the rows attribute indicates the number of lines in the input box. New Perspectives on HTML and XHTML, Comprehensive
Working with Text Area Control New Perspectives on HTML and XHTML, Comprehensive
Working with Text Area Control New Perspectives on HTML and XHTML, Comprehensive
Working with Form Buttons Buttons are a type of control element that performs an action. Types of buttons: Command button Submit button Reset button New Perspectives on HTML and XHTML, Comprehensive
Creating a Command button Command buttons are created using the <input> tag: <input type=“button” value=“text” /> Submit buttons submit forms to the server for processing when clicked. Syntax is as follows: <input type=“submit” value=“text” /> Reset buttons reset forms to their original (default) values. Syntax is as follows: <input type=“reset” value=“text” /> New Perspectives on HTML and XHTML, Comprehensive
Completed Form New Perspectives on HTML and XHTML, Comprehensive
Designing a Custom Button Use the button element for greater artistic control over the appearance of a button. <button name=“name” id=“id” value=“value” type=“type”> content </button> Where the name and value attributes specify the name of the button and the value sent to a server-based program, the id attribute specifies the button’s id, the type attribute specifies the button type, and the content is page content displayed within the button. New Perspectives on HTML and XHTML, Comprehensive
Creating File Buttons File buttons are used to select files so that their contents can be submitted for processing to a program. New Perspectives on HTML and XHTML, Comprehensive
Working with Hidden Fields New Perspectives on HTML and XHTML, Comprehensive Hidden fields are added to a form, but not displayed in the Web page. The syntax is as follows: <input type=“hidden” name=“name” id=“id” value=“value” />
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> 	Where url specifies the filename and location of the program that processes the form and the method attribute specifies how your Web browser sends data to the server. The enctype attribute specifies the format of the data stored in the form’s field. New Perspectives on HTML and XHTML, Comprehensive
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.” New Perspectives on HTML and XHTML, Comprehensive
Using the mailto Action The mailto action accesses the user’s own e-mail program and uses it to mail form information to a specified e-mail address. Bypasses the need for server-based programs. The syntax is as follows: <form action-mailto:e-mail method=“post”  enctype=“text/plain”> … </form> Where e-mail_addressis the e-mail address of the recipient in the form. New Perspectives on HTML and XHTML, Comprehensive
Tips for Creating Effective Forms Mark fields that are required, but also limit the number of unrequired fields. Don’t overwhelm your users with requests for information that is not really essential. Keep your forms short and to the point. If you need to collect a lot of information, break the form into manageable sections spread out over several pages. Allow users to easily move backward and forward through the forms without losing data. New Perspectives on HTML and XHTML, Comprehensive
Tips for Creating Effective Forms Provide detailed instructions about what users are expected to do. Don’t assume that your form is self-explanatory. If you ask for personal data and financial information, provide clear assurances that the data will be secure. If possible, provide a link to a Web page describing your security practices. Clearly indicate what users will receive once the form is submitted, and provide feedback on the Web site and through e-mail that tells them when their data has been successfully submitted. New Perspectives on HTML and XHTML, Comprehensive

Mais conteúdo relacionado

Mais procurados

Chapter 04
Chapter 04Chapter 04
Chapter 04llmeade
 
HTML5 Topic 1
HTML5 Topic 1HTML5 Topic 1
HTML5 Topic 1Juvywen
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding francopw
 
Chapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic OperationsChapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic Operationsfrancopw
 
Building and styling forms
Building and styling formsBuilding and styling forms
Building and styling formsanna-anna
 
How to build accessible UI components
How to build accessible UI componentsHow to build accessible UI components
How to build accessible UI componentsRuss Weakley
 
Chapter 05
Chapter 05Chapter 05
Chapter 05llmeade
 
Introduction to html (912 kb)
Introduction to html (912 kb)Introduction to html (912 kb)
Introduction to html (912 kb)IMRAN KHAN
 
Chapter 03
Chapter 03Chapter 03
Chapter 03llmeade
 
Aspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_csAspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_csMurali G
 
Getting started with the visual basic editor
Getting started with the visual basic editorGetting started with the visual basic editor
Getting started with the visual basic editorputiadetiara
 
Chapter 07
Chapter 07Chapter 07
Chapter 07llmeade
 
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 validationMaitree Patel
 
Fiverr html5 test answers 2020
Fiverr html5 test answers 2020Fiverr html5 test answers 2020
Fiverr html5 test answers 2020Roobon Habib
 
Intro to Excel Basics: Part I
Intro to Excel Basics: Part IIntro to Excel Basics: Part I
Intro to Excel Basics: Part ISi Krishan
 
Microsoft Excel Glossary & Keyboard Shortcuts-Function Keys
Microsoft Excel Glossary & Keyboard Shortcuts-Function KeysMicrosoft Excel Glossary & Keyboard Shortcuts-Function Keys
Microsoft Excel Glossary & Keyboard Shortcuts-Function Keyssdturton
 

Mais procurados (20)

Chapter 04
Chapter 04Chapter 04
Chapter 04
 
Excel Glosarry
Excel GlosarryExcel Glosarry
Excel Glosarry
 
HTML5 Topic 1
HTML5 Topic 1HTML5 Topic 1
HTML5 Topic 1
 
Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding Chapter 3 — Program Design and Coding
Chapter 3 — Program Design and Coding
 
Chapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic OperationsChapter 4 — Variables and Arithmetic Operations
Chapter 4 — Variables and Arithmetic Operations
 
Building and styling forms
Building and styling formsBuilding and styling forms
Building and styling forms
 
How to build accessible UI components
How to build accessible UI componentsHow to build accessible UI components
How to build accessible UI components
 
Chapter 05
Chapter 05Chapter 05
Chapter 05
 
Introduction to html (912 kb)
Introduction to html (912 kb)Introduction to html (912 kb)
Introduction to html (912 kb)
 
Chapter 03
Chapter 03Chapter 03
Chapter 03
 
Html 5 web forms 2
Html 5 web forms 2Html 5 web forms 2
Html 5 web forms 2
 
Aspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_csAspnet mvc tutorial_9_cs
Aspnet mvc tutorial_9_cs
 
Getting started with the visual basic editor
Getting started with the visual basic editorGetting started with the visual basic editor
Getting started with the visual basic editor
 
Android interface elements and controls-chapter8
Android interface elements and controls-chapter8Android interface elements and controls-chapter8
Android interface elements and controls-chapter8
 
Web I - 04 - Forms
Web I - 04 - FormsWeb I - 04 - Forms
Web I - 04 - Forms
 
Chapter 07
Chapter 07Chapter 07
Chapter 07
 
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
 
Fiverr html5 test answers 2020
Fiverr html5 test answers 2020Fiverr html5 test answers 2020
Fiverr html5 test answers 2020
 
Intro to Excel Basics: Part I
Intro to Excel Basics: Part IIntro to Excel Basics: Part I
Intro to Excel Basics: Part I
 
Microsoft Excel Glossary & Keyboard Shortcuts-Function Keys
Microsoft Excel Glossary & Keyboard Shortcuts-Function KeysMicrosoft Excel Glossary & Keyboard Shortcuts-Function Keys
Microsoft Excel Glossary & Keyboard Shortcuts-Function Keys
 

Semelhante a Html Xhtml And Xml 3e Tutorial 6 (20)

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 form
Html formHtml form
Html form
 
M02 un11 p01
M02 un11 p01M02 un11 p01
M02 un11 p01
 
HTML Forms
HTML FormsHTML Forms
HTML Forms
 
Web(chap2)
Web(chap2)Web(chap2)
Web(chap2)
 
Xhtml Part2
Xhtml Part2Xhtml Part2
Xhtml Part2
 
HTML-Forms
HTML-FormsHTML-Forms
HTML-Forms
 
Html forms
Html formsHtml forms
Html forms
 
CSS_Forms.pdf
CSS_Forms.pdfCSS_Forms.pdf
CSS_Forms.pdf
 
Chapter09
Chapter09Chapter09
Chapter09
 
html forms
html formshtml forms
html forms
 
Html4
Html4Html4
Html4
 
HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.HtmlForms- basic HTML forms description.
HtmlForms- basic HTML forms description.
 
Input tags (report)
Input tags (report)Input tags (report)
Input tags (report)
 
2. HTML forms
2. HTML forms2. HTML forms
2. HTML forms
 
ASSIGNMENT3 ew.docx
ASSIGNMENT3 ew.docxASSIGNMENT3 ew.docx
ASSIGNMENT3 ew.docx
 
uptu web technology unit 2 html
uptu web technology unit 2 htmluptu web technology unit 2 html
uptu web technology unit 2 html
 
Mengelola isi halaman web1 eng
Mengelola isi halaman web1 engMengelola isi halaman web1 eng
Mengelola isi halaman web1 eng
 
HTML
HTML HTML
HTML
 

Último

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxLoriGlavin3
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxfnnc6jmgwh
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...itnewsafrica
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesManik S Magar
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkPixlogix Infotech
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxLoriGlavin3
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxLoriGlavin3
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI AgeCprime
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integrationmarketing932765
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPathCommunity
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.Curtis Poe
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructureitnewsafrica
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxLoriGlavin3
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Kaya Weers
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfpanagenda
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfIngrid Airi González
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Hiroshi SHIBATA
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024Lonnie McRorey
 

Último (20)

The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptxThe Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
The Role of FIDO in a Cyber Secure Netherlands: FIDO Paris Seminar.pptx
 
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptxGenerative AI - Gitex v1Generative AI - Gitex v1.pptx
Generative AI - Gitex v1Generative AI - Gitex v1.pptx
 
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...Abdul Kader Baba- Managing Cybersecurity Risks  and Compliance Requirements i...
Abdul Kader Baba- Managing Cybersecurity Risks and Compliance Requirements i...
 
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotesMuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
MuleSoft Online Meetup Group - B2B Crash Course: Release SparkNotes
 
React Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App FrameworkReact Native vs Ionic - The Best Mobile App Framework
React Native vs Ionic - The Best Mobile App Framework
 
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptxUse of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
Use of FIDO in the Payments and Identity Landscape: FIDO Paris Seminar.pptx
 
The State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptxThe State of Passkeys with FIDO Alliance.pptx
The State of Passkeys with FIDO Alliance.pptx
 
A Framework for Development in the AI Age
A Framework for Development in the AI AgeA Framework for Development in the AI Age
A Framework for Development in the AI Age
 
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS:  6 Ways to Automate Your Data IntegrationBridging Between CAD & GIS:  6 Ways to Automate Your Data Integration
Bridging Between CAD & GIS: 6 Ways to Automate Your Data Integration
 
UiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to HeroUiPath Community: Communication Mining from Zero to Hero
UiPath Community: Communication Mining from Zero to Hero
 
How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.How AI, OpenAI, and ChatGPT impact business and software.
How AI, OpenAI, and ChatGPT impact business and software.
 
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical InfrastructureVarsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
Varsha Sewlal- Cyber Attacks on Critical Critical Infrastructure
 
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptxMerck Moving Beyond Passwords: FIDO Paris Seminar.pptx
Merck Moving Beyond Passwords: FIDO Paris Seminar.pptx
 
Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)Design pattern talk by Kaya Weers - 2024 (v2)
Design pattern talk by Kaya Weers - 2024 (v2)
 
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdfSo einfach geht modernes Roaming fuer Notes und Nomad.pdf
So einfach geht modernes Roaming fuer Notes und Nomad.pdf
 
Generative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdfGenerative Artificial Intelligence: How generative AI works.pdf
Generative Artificial Intelligence: How generative AI works.pdf
 
Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024Long journey of Ruby standard library at RubyConf AU 2024
Long journey of Ruby standard library at RubyConf AU 2024
 
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyesHow to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
How to Effectively Monitor SD-WAN and SASE Environments with ThousandEyes
 
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data PrivacyTrustArc Webinar - How to Build Consumer Trust Through Data Privacy
TrustArc Webinar - How to Build Consumer Trust Through Data Privacy
 
TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024TeamStation AI System Report LATAM IT Salaries 2024
TeamStation AI System Report LATAM IT Salaries 2024
 

Html Xhtml And Xml 3e Tutorial 6

  • 1. Tutorial 6 Working with Web Forms
  • 2. Objectives Explore how Web forms interact with Web servers Create form elements Create field sets and legends Create input boxes and form labels Creation option buttons Create selection lists Create check boxes New Perspectives on HTML and XHTML, Comprehensive
  • 3. Objectives Create text area boxes Apply styles to Web forms Work with form buttons Explore image elements and hidden fields Work with form actions and methods New Perspectives on HTML and XHTML, Comprehensive
  • 4. Introducing Web Forms Web forms collect information from Web site visitors. Web forms include different control elements including: Input boxes Option buttons or radio buttons Selection lists Drop-down lists boxes Check boxes Text areas New Perspectives on HTML and XHTML, Comprehensive
  • 5. Forms and Server-Based Programs While HTML supports the creation of forms, it does not include tools to process the information. The information can be processed through a program running on a Web server. New Perspectives on HTML and XHTML, Comprehensive
  • 6. Forms and Server-Based Programs Server-based programs are written in many languages The earliest and most commonly used are Common Gateway Interface (CGI) scripts that are written in Perl. Other popular languages include: ASP ColdFusion C/C++ PHP VBScript New Perspectives on HTML and XHTML, Comprehensive
  • 7. Creating a Web Form Forms are created using the form element, structured as follows: <form attributes> elements </form> Where attributesare the attributes that control how the form is processed and elements are elements places within the form. New Perspectives on HTML and XHTML, Comprehensive
  • 8. Creating a Web Form Form attributes usually tell the browser the location of the server-based program to be applied to the form’s data. Always specify an id or name for the form. Two attributes are available to identify the form: id and name. New Perspectives on HTML and XHTML, Comprehensive
  • 9. Creating a Web Form The syntax of the id and name attributes are as follows: <form name=“name” id=“id”>… </form> Where name is the name of the form and id is the id of the form. New Perspectives on HTML and XHTML, Comprehensive
  • 10. Creating a Field Set HTML and XHTML allow you to organize option buttons into a group of fields called field sets. <fieldset id=“id”> controls </fieldset> where id identifies the field set and controls are the control elements associated with fields within the field set New Perspectives on HTML and XHTML, Comprehensive
  • 11. Creating a Field Set To add a caption to a field set, add the following tag after the opening <fieldset> tag: <legend>text</legend> Where text is the text of the field set caption. New Perspectives on HTML and XHTML, Comprehensive
  • 12. Creating Input Boxes The general syntax of input elements is as follows:<input type=“type” name=“name” id=“id” /> Where type specifies the type of input control, and the name and id attributes provide the control’s name and id. New Perspectives on HTML and XHTML, Comprehensive
  • 13. Creating Input Boxes New Perspectives on HTML and XHTML, Comprehensive
  • 14. Working with Field Labels You can also expressly link a label with an associated text element for scripting purposes. The syntax for creating a form label is as follows: <label for=“id”>label text</label> Where id is the value of the id attribute for a field’s control element, and label text is the text of the label. New Perspectives on HTML and XHTML, Comprehensive
  • 15. Setting the Width of an Input Box To change the width of an input box, use the width attribute, which is displayed as follows: #id {width: value} Where id is the id of the control and value is the width you want to apply to the input box New Perspectives on HTML and XHTML, Comprehensive
  • 16. Setting the Width of an Input Box New Perspectives on HTML and XHTML, Comprehensive
  • 17. Creating Option Buttons New Perspectives on HTML and XHTML, Comprehensive Option buttons, or radio buttons allow users to make selections. Unlike selection lists, option buttons only allow the user to select one option at a time.
  • 18. Creating a Group of Option Buttons New Perspectives on HTML and XHTML, Comprehensive To create a group of option buttons associated with a single field, add the elements: <input type="radio" name="name" id="id1" value="value1" /> <input type="radio" name="name" id="id2" value="value2" /> <input type="radio" name="name" id="id3" value="value3" /> to the Web form, where name identifies the field associated with the collection of optionbuttons; id1, id2, id3, etc. identify the specific options; and value1, value2, value3, etc.are the field values associated with each option. To specify the default option, add the following attribute to the <input> tag: checked="checked"
  • 19. Creating a Selection List A selection list is a list box from which a user selects a particular field value or set of field values. Selection lists are useful when there are a fixed set of possible responses from the user. You can create a selection list using the <select> element. You can specify each individual selection item using the <option> element. New Perspectives on HTML and XHTML, Comprehensive
  • 20. Setting the Selection List Size You can change the number of options displayed in the selection list by modifying the size attribute. The syntax is as follows: <select size= “value”>… </select> Where value is the number of items that the selection list displays in the form. New Perspectives on HTML and XHTML, Comprehensive
  • 21. Setting the Selection List Size New Perspectives on HTML and XHTML, Comprehensive
  • 22. Making Multiple Selections Add the multiple attribute to the select element to create multiple selections: <select multiple=“multiple”>… </select> New Perspectives on HTML and XHTML, Comprehensive
  • 23. Working with Check Boxes To create a check box, use: <input type=“checkbox” name=“name” id=“id” value=“value” /> Where the name and id attributes identify the check box controls and the value attribute specifies the value sent to the server if the check box is selected. To specify that a check box be selected by default, use the checked attribute as follows: <input type=“checkbox” checked=“checked” /> New Perspectives on HTML and XHTML, Comprehensive
  • 24. Specifying the Tab Order Users typically navigate through a form with the tab key. You can specify an alternate tab order by adding the tabindex attribute to any control element in your form. The syntax is as follows: <input name=“fname” id=“firstName” tabindex=“1” /> This syntax assigns the tab index number “1” to the fname field from the registration form. New Perspectives on HTML and XHTML, Comprehensive
  • 25. Working with Text Area Control Text area boxes allow users to enter comments. An input box would be too small to accommodate the length of text for this use. New Perspectives on HTML and XHTML, Comprehensive
  • 26. Working with Text Area Control To create a text area box, use the textarea element: <textarea rows="value" cols="value"> ... </textarea> Where the rows and cols attributes define the dimensions of the input box and the rows attribute indicates the number of lines in the input box. New Perspectives on HTML and XHTML, Comprehensive
  • 27. Working with Text Area Control New Perspectives on HTML and XHTML, Comprehensive
  • 28. Working with Text Area Control New Perspectives on HTML and XHTML, Comprehensive
  • 29. Working with Form Buttons Buttons are a type of control element that performs an action. Types of buttons: Command button Submit button Reset button New Perspectives on HTML and XHTML, Comprehensive
  • 30. Creating a Command button Command buttons are created using the <input> tag: <input type=“button” value=“text” /> Submit buttons submit forms to the server for processing when clicked. Syntax is as follows: <input type=“submit” value=“text” /> Reset buttons reset forms to their original (default) values. Syntax is as follows: <input type=“reset” value=“text” /> New Perspectives on HTML and XHTML, Comprehensive
  • 31. Completed Form New Perspectives on HTML and XHTML, Comprehensive
  • 32. Designing a Custom Button Use the button element for greater artistic control over the appearance of a button. <button name=“name” id=“id” value=“value” type=“type”> content </button> Where the name and value attributes specify the name of the button and the value sent to a server-based program, the id attribute specifies the button’s id, the type attribute specifies the button type, and the content is page content displayed within the button. New Perspectives on HTML and XHTML, Comprehensive
  • 33. Creating File Buttons File buttons are used to select files so that their contents can be submitted for processing to a program. New Perspectives on HTML and XHTML, Comprehensive
  • 34. Working with Hidden Fields New Perspectives on HTML and XHTML, Comprehensive Hidden fields are added to a form, but not displayed in the Web page. The syntax is as follows: <input type=“hidden” name=“name” id=“id” value=“value” />
  • 35. 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> Where url specifies the filename and location of the program that processes the form and the method attribute specifies how your Web browser sends data to the server. The enctype attribute specifies the format of the data stored in the form’s field. New Perspectives on HTML and XHTML, Comprehensive
  • 36. 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.” New Perspectives on HTML and XHTML, Comprehensive
  • 37. Using the mailto Action The mailto action accesses the user’s own e-mail program and uses it to mail form information to a specified e-mail address. Bypasses the need for server-based programs. The syntax is as follows: <form action-mailto:e-mail method=“post” enctype=“text/plain”> … </form> Where e-mail_addressis the e-mail address of the recipient in the form. New Perspectives on HTML and XHTML, Comprehensive
  • 38. Tips for Creating Effective Forms Mark fields that are required, but also limit the number of unrequired fields. Don’t overwhelm your users with requests for information that is not really essential. Keep your forms short and to the point. If you need to collect a lot of information, break the form into manageable sections spread out over several pages. Allow users to easily move backward and forward through the forms without losing data. New Perspectives on HTML and XHTML, Comprehensive
  • 39. Tips for Creating Effective Forms Provide detailed instructions about what users are expected to do. Don’t assume that your form is self-explanatory. If you ask for personal data and financial information, provide clear assurances that the data will be secure. If possible, provide a link to a Web page describing your security practices. Clearly indicate what users will receive once the form is submitted, and provide feedback on the Web site and through e-mail that tells them when their data has been successfully submitted. New Perspectives on HTML and XHTML, Comprehensive