Presentation is loading. Please wait.

Presentation is loading. Please wait.

Web Development & Design Foundations with XHTML Chapter 9 Key Concepts.

Similar presentations


Presentation on theme: "Web Development & Design Foundations with XHTML Chapter 9 Key Concepts."— Presentation transcript:

1 Web Development & Design Foundations with XHTML Chapter 9 Key Concepts

2 Student Presentations 2

3 ADVERTISEMENT CS190: Introduction to Programming Using Visual Basic ◦ Intro class. If you are a CS major, you will still have to take CS201, but 190 covers some of the same material and is *much easier* than 201, so it gives you a head start. ◦ We won’t be doing any web programming in CS190, but one of the main uses for VB.NET is for server-side programming with Microsoft’s ASP.NET platform I’m also teaching CS290: Intro to Programming with Fortran. Fortran is not very relevant to web programming, but this class will also be an easy intro to programming. Designed for non-CS majors. 3

4 Overview of Forms Forms are used all over the Web to ◦ Accept information ◦ Provide interactivity Types of forms: ◦ Search form, Order form, Newsletter sign-up form, Survey form, Add to Cart form, and so on… 4

5 Overview of Forms (2) Form ◦ An XHTML element that contains and organizes form controls such as text boxes, check boxes, and buttons that can accept information from Web site visitors. 5

6 Two Components of Using Forms 1. The XHTML form -- the Web page user interface and 2. The server-side processing Server-side processing works with the form data and sends e-mail, writes to a text file, updates a database, or performs some other type of processing on the server. 6

7 XHTML Using Forms tag ◦ Contains the form elements on a web page ◦ Container tag tag ◦ Configures a variety of form elements including text boxes, radio buttons, check boxes, and buttons ◦ Stand alone tag tag ◦ Configures a text box ◦ Container tag tag ◦ Configures a select box (drop down list) ◦ Container tag tag ◦ Configures an option in the select box ◦ Container tag 7

8 Sample Form XHTML Email: 8

9 XHTML element The form tag attributes: ◦ action  Specifies the server-side program or script that will process your form data  eg ◦ method  get – default value, form data passed in URL  post – more secure, form data passed in HTTP Entity Body ◦ name  Identifies the form ◦ id  Identifies the form 9

10 XHTML Text box Accepts text information Attributes: ◦ type=“text” ◦ name ◦ id ◦ size ◦ maxlength ◦ value 10

11 XHTML Text box Email: 11

12 XHTML Password box Accepts text information that needs to be hidden as it is entered Attributes: ◦ type=“password” ◦ name ◦ id ◦ size ◦ maxlength ◦ value 12

13 XHTML Check box Allows the user to select one or more of a group of predetermined items Attributes: ◦ type=“checkbox” ◦ name ◦ id ◦ checked ◦ value 13

14 XHTML Radio Button Allows the user to select exactly one from a group of predetermined items Each radio button in a group is given the same name and a unique value Attributes: ◦ type=“radio” ◦ name ◦ id ◦ checked ◦ value 14

15 XHTML Radio Button Yes No 15

16 XHTML Select List Configures a select list (along with tags) Also known as: Select Box, Drop-Down List, Drop-Down Box, and Option Box. Allows the user to select one or more items from a list of predetermined choices. Attributes: ◦ name ◦ id ◦ size ◦ multiple 16

17 XHTML Options in a Select List Configures the options in a Select List Attributes: ◦ value ◦ selected 17

18 XHTML Select List Yes! No! 18

19 XHTML Submit Button Submits the form information When clicked: ◦ Triggers the action method on the tag ◦ Sends the form data (the name=value pair for each form element) to the web server. Attributes: ◦ type=“submit” ◦ name ◦ id ◦ value 19

20 XHTML Reset Button Resets the form fields to their initial values Attributes: ◦ type=“reset” ◦ name ◦ id ◦ value 20

21 XHTML Button Offers a flexible user interface There is no default action when the button is clicked Usually a JavaScript function is invoked when a button is clicked Attributes: ◦ type=“button” ◦ name ◦ id ◦ value 21

22 XHTML Hidden form data This form control is not displayed on the Web page. Hidden form fields ◦ Can be accessed by both client-side and server-side scripting ◦ Sometimes used to contain information needed as the visitor moves from page to page. Attributes: ◦ type=“hidden” ◦ name ◦ id ◦ value 22

23 XHTML Hidden form data Your Reply name: email: subject: comments: Joe Smiley wrote: : I think Hamlet doesn't act because if he does, the play's over. 23

24 Hands-On Practice 9.2

25 XHTML Using a Table to Format a Form Name: Email: 25

26 XHTML Form Enhancements Tag Associates a text label with a form control Two Different Formats: Email: Or Email: 26

27 XHTML Form Enhancements & Tags The Fieldset Element ◦ Container tag ◦ Creates a visual group of form elements on a web page The Legend Element ◦ Container tag ◦ Creates a text label within the fieldset 27 Customer Information Name: Email:

28 XHTML Form Enhancements tabindex attribute Attribute that can be used on form controls and anchor tags Modifies the default tab order Assign a numeric value 28

29 XHTML Form Enhancements accesskey attribute Attribute that can be used on form controls and anchor tags Create a “hot-key” combination to place the focus on the component Assign a value of a keyboard letter On Windows use the ALT and the “hot-key” to move the cursor (worked for me in IE and Chrome, not in Firefox) 29

30 XHTML Form Enhancements Image Button Submits the form When clicked: ◦ Triggers the action method on the tag ◦ Sends the form data (the name=value pair for each form element) to the Web server. Attributes: ◦ type=“image” ◦ name ◦ id ◦ src 30

31 XHTML Form Enhancements Element A container tag When clicked, its function depends on the value of the type attribute. Can contain a combination of text, images, and media Attributes: ◦ type=“submit”, type=“reset”, type=“button” ◦ name ◦ id ◦ alt ◦ value 31

32 Using CSS to Style a Form Moderate Approach ◦ Use a table to format the form but configure styles instead of XHTML table attributes. 32 table { border: 3px solid #000000; width: 100%;} td { padding: 5px; margin: 0px;}.mylabel { text-align: right;}

33 Using CSS to Style a Form “Pure" CSS Approach ◦ Do not use a table to format the form. ◦ Use CSS divs and spans with positioning properties to configure the page. 33 #myForm {border:3px solid #000000; padding:10px;margin:10px;}.myRow {padding-bottom: 20px;.labelCol {float:left;width:100px; text-align:right;}

34 Form Example 34 formsample.html

35 Server-Side Processing Your web browser requests web pages and their related files from a web server. The web server locates the files, may do other processing of data, and sends documents to your web browser. The web browser then renders the returned files and displays the requested web pages for you to use. 35

36 Common Uses of Server-Side Scripting Search a database Place an order at an online store Send a web page to a friend Subscribe to a newsletter 36

37 CGI Common Gateway Interface A protocol for a web server to pass a web page user's request to an application program and accept information to send to the user. 37

38 Server-Side Scripting One of many technologies in which a server-side script is embedded within a Web page document saved with a file extension such as: ◦.php (PHP) ◦.asp (Active Server Pages) ◦.jsp (Sun JavaServer Pages) ◦.aspx (ASP.Net). Uses direct execution — the script is run either by the Web server itself or by an extension module to the Web server. 38

39 Steps in Utilizing Server-Side Processing 1. Web page invokes server-side processing by a form or hyperlink. 2. Web server executes a server-side script. 3. Server-side script accesses requested database, file, or process. 4. Web server returns Web page with requested information or confirmation of action. 39

40 Server-Side Scripting Technologies JavaServer Pages http://java.sun.com/products/jsp http://java.sun.com/products/jsp ColdFusion http://www.adobe.com/products/coldfusion http://www.adobe.com/products/coldfusion PHP http://www.php.net http://www.php.net Ruby on Rails http://www.rubyonrails.org or http://tryruby.hobix.com http://www.rubyonrails.orghttp://tryruby.hobix.com Microsoft’s ASP.NET Framework http://www.microsoft.com/net http://www.microsoft.com/net 40

41 ASP.NET Benefits ◦ Good set of tools ◦ Tools are well-integrated ◦ Speedy performance (at least in development) ◦ Easy dependency management ◦ Easy design of basic GUIs and typical functionality ◦ Easy (MS) Database Access

42 ASP.NET Overview Drawbacks Tied to Microsoft ◦ Must do development in Windows, use IIS web server under Windows ◦ Proprietary programming languages ◦ Lose some benefits if use DB other than MS SQL Server ◦ Must trust MS to render output well for non-IE browsers ◦ No code portability Tools cost money if used in production

43 PHP Open source language, available free for all major environments Originally called “Personal Home Page,” but turned out to be very scalable Used by Facebook, Wikipedia, other high- volume sites Build code into scripts on the html page or link to external scripts

44 Wikimedia architecture

45

46 Java Web Programming CS320 and CS 520 at CSULA use Java Easy to integrate open source Java libraries for sophisticated backend functionality ◦ Security ◦ Machine Learning ◦ E-Commerce Easy to use free technologies for entire app

47 Java Web Programming Typically use an application framework ◦ structures the app according to a predefined architecture ◦ steep learning curve ◦ More configuration, less coding

48 Sources of Free Server-Side Processing Many web host providers offer free scripts for their clients for simple functionality. Contact their support area or FAQ to learn more about their services. Some web sites that offer FREE remotely hosted scripts (in return for displaying ads). ◦ http://formbuddy.com http://formbuddy.com ◦ http://response-o-matic.com http://response-o-matic.com ◦ http://master.com http://master.com ◦ http://www.formmail.com http://www.formmail.com ◦ http://wufoo.com http://wufoo.com ◦ http://iceberg.com http://iceberg.com ◦ http://formassembly.com http://formassembly.com 48


Download ppt "Web Development & Design Foundations with XHTML Chapter 9 Key Concepts."

Similar presentations


Ads by Google