Download presentation
Presentation is loading. Please wait.
Published byNathan Jordan Modified over 8 years ago
1
1 Web Engineering Forms Lecture 05
2
FORMS Its how HTML does interactivity. There are quite new feature in HTML5. But the fundamental idea does not change since the first web browser. There basically two ways to use forms in HTML. Traditionally they are mostly use to interface with the process on server using PHP/ASP. Today they are often use to interface with JavaScript running on client machine.
3
Interactive Forms (1) Without forms, a Web site is “read-only” – it just provides information to the user. Forms enable the user to provide information to the Web site. For example, the user can: – Perform searches on Web site – Give comments – Ask for info that is not available on the Website – Place order for goods and services
4
4 Interactive Forms (2) Can be simple or very complex Can fill a whole page or just a single line Can contain a single element or many Are always placed between the and tags of a Web page
5
5 Interactive Forms (3) Are GUI-based May contain: – Text fields – Check boxes – Buttons – Scrollable lists
6
FORM Tag All of the component of a form appear in the content of a tag. Example: The action attribute specifies the URL of the application on the web server that is to be called when the user clicks the SUBMIT button. The method attribute specifies one of the two techniques, get or post. Used to pass the form data to the server.
7
INPUT Tag tag is used for text, passwords, checkboxes, radio buttons, action button reset and submit. One attribute of tag is type, which specifies particular kind of controls Example
8
8 Single-Line Text Input Field <INPUT type= “ text ” name= “ fieldName ” size= “ widthInCharacters ” maxlength= “ limitInCharacters ” value= “ initialDefaultValue ” placeholder= “ initialDefaultValue ” autofocus required readonly />
9
9
10
10 Password Input Field <INPUT type=“password” name=“fieldName” size=“widthInCharacters” maxlength=“limitInCharacters” value=“initialDefaultValue” placeholder= “ initialDefaultValue ” />
11
11 Multi-Line Text Input Area <TEXTAREA name= “ areaName ” cols= “ widthInCharacters ” rows= “ numberOfLines ” spellcheck= “ true/false ” >
12
EXAMPLE <TEXTAREA name= “ message ” cols= “ 38 ” rows= “ 6 ” wrap= “ virtual ” > wrap= “ virtual ” specifies that text in the box will wrap lines as needed 12
13
13 Submit Button Input
14
14 Reset Button Input Element ( Resets the contents of a form to default values ) <INPUT type= “ reset ” value= “ dispalyedText ” >
15
15
16
16 From: To: Subject: Message:
17
17
18
18 User Name: Password:
19
19 Checkbox Input Element <INPUT type= “ checkbox ” name= “ checkboxName ” checked value= “ checkedValue ” />
20
20
21
21 Radio Button Input Element <INPUT type= “ radio ” name= “ radioButtonName ” checked value= “ selectedValue ” />
22
22
23
23 User Name: Password: Logging in from: Home Home University
24
24
25
25 Select from a (Drop Down) List <SELECT name= “ listName ” size= “ numberOfDisplayedChoices ” multiple > text1 text2 …
26
26
27
27 File Upload Input Element <INPUT type= “ file ” name= “ uploadfile ” enctype= “ multipart/form-data ” size= “ 35 ” >
28
28 Date Input Element <INPUT type= “ date ” name= “ date1 ” pattern= “ \d{4}-\d{2}-\d{2} ” title= “ YYYY-DD-MM ” >
29
29 Number Input Element <INPUT type= “ number ” name= “ number1 ” min= “ 1 ” max= “ 5 ” value= “ 1 ” />
30
30 Range Input Element <INPUT type= “ range ” name= “ range1 ” min= “ 0 ” max= “ 100 ” step= “ 10 ” value= “ 20 ” />
31
31 Search Input Element
32
32 URL Input Element
33
33 Color Input Element <INPUT type= “ color ” name= “ color1 ” value= “ #336699 ” />
34
34 16 Possible Values for the “type” Attribute of tag 1.text 2.password 3.hidden 4.checkbox 5.radio 6.file 7.reset 8.submit 9.url 10.email 11.tel 12.time 13.date 14.search 15.range 16.datetime-local
Similar presentations
© 2024 SlidePlayer.com Inc.
All rights reserved.