Presentation is loading. Please wait.

Presentation is loading. Please wait.

HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab.

Similar presentations


Presentation on theme: "HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab."— Presentation transcript:

1 HTML III (Forms) Robin Burke ECT 270

2 Outline Where we are in this class Web applications HTML Forms Break Forms lab

3 Introduction to the course Overview of networking, the Internet and the WWW, Unix survival 1 st week HTML 3 weeks Cascading Style Sheets 1.5 weeks JavaScript 4 weeks

4 Last class on HTML Mastery of this material will be assumed Midterm JavaScript Final Project

5 Web application Application "A complete, self-contained program that performs a specific function directly for the user" Web application an application delivered over the WWW

6 Web applications Core of web development 90% of the web's "pages" are generated from user input only 10% are static pages Partly not in our scope ECT 353 teaches how to build those kinds of applications But web applications need input Input comes from HTML forms

7 Example applications Course online CampusConnect course search Ugly! Any search engine

8 Architecture

9 Web client browser Request URL + parameters input from the user Web server dispatches request to application Application processes input produces output either page or data processed by web server to produce page

10 Input data Either part of URL (GET method) part of request body (POST method) Form data name-value pairs ? syntax for GET Uploaded files "multi-part" content POST only

11 Building Web Applications Simplest run a program taking user's input CGI, ISAPI, Java servlet Easiest to develop write a web page with special scripting behavior ASP, JSP, PHP, ColdFusion Most flexible separate data from HTML XML, Struts

12 For this class "Echo" application Displays a page with the input

13 What all these share... the need to get user input from a web page Form of input name-value pair How to get from user? depends on the data

14 Form element chunk a part of the page in which input tags can be placed defines the URL where user data will be sent defines processing mechanism

15 Input elements name and value attributes user can change the value attribute how depends on the type text field selection list radio button, etc

16 Example

17 Simple example Simple form example

18 Input elements Treated like other page elements can be organized into paragraph, tables, etc. Form layout is almost always table- based All use the same base element INPUT what kind of input controlled by the type attribute

19 Input elements

20 Text field Example Attributes type attribute determines the kind of input name & id are equivalent but id is not widely implemented value is initial contents of field size is width of field maxlength is the number of chars accepted

21 Labels No inherent labeling regular HTML text used HTML 4.0 adds label element only available where id attribute is recognized Otherwise use text and layout to identify form elements

22 Label element Benefits can be scripted can be handled by non-visual browsers Element Label text place where you want the text to appear

23 Checkboxes Allow a simple interface to a yes/no choice Attributes value will be included in the parameters if the box is checked checked controls whether the box is checked by default Not XHTML compliant checked="true"

24 Example Enter query: <input name="field_example" id="field_example3" type="text" value=""> Local search only: <input type="checkbox" name="checkbox" value="checkbox" checked>

25 Radio buttons Allow the user to select one from a (short) list of options Groups Radio buttons come in groups Groups are defined by shared name attributes

26 Radio Button Attributes name only one field for a group of radio buttons the name attribute does the linking if buttons don't link, check name fields id must be unique for each element identifies a radio button uniquely value what the value the field will have if this button is checked checked which button of a group will be the default

27 Example Enter query: <input name="field_example" id="field_example3" type="text" value=""> Search type: Local: <input type="radio" name="search_type" id="local" value="local" checked> Full: <input type="radio" name="search_type" id="full" value="full">

28 Grouping fieldset tag can be used to group logical elements like radio buttons

29 Example Search type Local <input type="radio" name="search_type" id="local" value="local" checked> Full <input type="radio" name="search_type" id="full" value="full">

30 Selection lists Radio buttons are not good for long lists of options menus – good for single selection list box – good for larger lists and multiple selection Problem awkward to use the INPUT element different structure needed

31 Select element Select element specifies a selection list either a menu (size=1), or a list box (size > 1) Contains option elements to specify each choice

32 Example <select size="1" name="search_type" id="search_type"> Local Full

33 Attributes Select element size is the number of elements displayed at one time 1 = menu otherwise box of given height multiple means that multiple selections are allowed name is the field name Option element value is the value of the field if this option is chosen selected identifies the default value

34 Example <select size="4" name="search_type" id="search_type" multiple> Local Special Collections Technical Reports Press Releases Full

35 Buttons Types submit button sends the request to the server reset button returns all fields to default action (or push) button can execute a scripted action user-formated button separate button element

36 Reset and submit Must have a submit button reset is optional value attribute controls the text of the button doesn't have to be "Submit"

37 User-formatted button Example Run the search Embedded HTML displayed in button

38 More form elements Password input element type = "password" typed text not displayed Hidden input element type = "hidden" contents not displayed not editable by user vulnerable to hacking File input element type = "file" lets the user choose a file to upload (as in COL)

39 Still more form elements Image input element type = "image" like a submit button, but location information in request Textarea not an input tag multi-line input allowed element contents become default text

40 Moving through a form: tabs Tabs move from one field to another always in HTML order Can specify tab order in input elements tabindex attribute

41 Moving through a form: keys We can also jump around in the form Using access keys accesskey attribute

42 Final example


Download ppt "HTML III (Forms) Robin Burke ECT 270. Outline Where we are in this class Web applications HTML Forms Break Forms lab."

Similar presentations


Ads by Google