Presentation is loading. Please wait.

Presentation is loading. Please wait.

FORMS. Forms are used to receive information from the web surfer, such as: their name, email address, credit card, etc. Form fields are objects that allow.

Similar presentations


Presentation on theme: "FORMS. Forms are used to receive information from the web surfer, such as: their name, email address, credit card, etc. Form fields are objects that allow."— Presentation transcript:

1 FORMS

2 Forms are used to receive information from the web surfer, such as: their name, email address, credit card, etc. Form fields are objects that allow the visitor to enter information - for example text boxes, drop-down menus or radio buttons.

3 Different fields/objects in a form Text fields Password fields Radio button Check box Drop down list Selection list Text area Submit button Email to

4 Text fields password fields Option/radio button Check box Drop down list Text area Submit button Commerce Science Arts stream Selection list

5 FORMS When a form is submitted, all fields on the form are being sent. The tag tells the browser where the form starts and ends. You can add all kinds of HTML tags between the and tags. To let the browser know where to send the content add the following properties to the tag: action=address method=post or method=get The action specifies the URL to send the data to. The methods are the different methods for submitting data to the script. "GET" should be used if and only if the form processing is a pure query form. There are, however, problems related to long URLs which make it necessary to use "POST" even for pure query cases.

6 Text Fields tag is used to tell the browser what type of field you want. The has a few attributes that you should be aware of. type - Determines what kind of input field it will be. Possible choices are text, submit, and password. name - Assigns a name to the given field so that you may reference it later. size - Sets the horizontal width of the field. The unit of measurement is in blank spaces. maxlength - Dictates the maximum number of characters that can be entered.

7 HTML Code: Name: Password: Simply change the email address to your own and you will have set up your first functional form!

8 Radio Buttons Radio buttons are a popular form of interaction. You may have seen them on quizzes, questionnaires, and other web sites that give the user a multiple choice question. value - specifies what will be sent if the user chooses this radio button. Only one value will be sent for a given group of radio buttons name - defines which set of radio buttons that it is a part of. Eg: shade and size.

9 HTML Code: What kind of shirt are you wearing? Shade: Dark Light Size: Small Medium Large

10 Check Boxes Check boxes allow for multiple items to be selected for a certain group of choices. The check box's name and value attributes behave the same as a radio button.

11 HTML Code: Select your favorite cartoon characters. Goofy Donald Bugs Bunny Scooby Doo

12 Drop Down Lists Drop down menues are created with the and tags. is the list itself and each is an available choice for the user.

13 HTML Code: College Degree? Choose One Some High School High School Degree Some College Bachelor's Degree Doctorate

14 Selection Forms Yet another type of form, a highlighted selection list. This form will post what the user highlights. Basically just another type of way to get input from the user. The size attribute selects how many options will be shown at once before needing to scroll, and the selected option tells the browser which choice to select by default.

15 HTML Code: Musical Taste Emo Metal/Rock Hip Hop Ska Jazz Country Classical Alternative Oldies Techno

16 HTML Text Areas Text areas serve as an input field for viewers to place their own comments onto. Forums and the like use text areas to post what you type onto their site using scripts. For this form, the text area is used as a way to write comments to somebody. Rows and columns need to be specified as attributes to the tag. columns reflects how many characters wide the text area will be and the rows the height of the text box

17 Attribute of textarea Wrap has 3 values. wrap= "off" "virtual" "physical" Virtual means that the viewer will see the words wrapping as they type their comments, but when the page is submitted to you, the web host, the document sent will not have wrapping words. Physical means that the text will appear both to you, the web host, and the viewer including any page breaks and additional spaces that may be inputed. The words come as they are. Off of course, turns off word wrapping within the text area. One ongoing line.

18 HTML Code: Enter Comments Here Also note that any text placed between the opening and closing textarea tags will show up inside the text area when the browser views it.

19 Submit Generally, the submit button should be the last item of your form. Here is a list of important attributes of the submit: In addition to adding the submit button, we must also add a destination for this information and specify how we want it to travel to that place. method - We will only be using the post functionality of method, which sends the data without displaying any of the information to the visitor. action - Specifies the URL to send the data to. We will be sending our information to a fake email address.

20 Send email from a form This form sends an e-mail to W3Schools. Name: <input type="text" name="name" value="yourname" size="20"> Mail: <input type="text" name="mail" value="yourmail" size="20"> Comment: <input type="text" name="comment" value="yourcomment" size="40">

21 Reset button When a visitor clicks a reset button, the entries are reset to the default values. Reset attributes name, value, align The name setting adds an internal name to the button so the program that handles the form doesn't confuse the button with the other fields. The value setting defines what is written on the button. The align setting defines how the button is aligned. Valid entries are: TOP, MIDDLE, BOTTOM, RIGHT, LEFT, TEXTTOP, BASELINE, ABSMIDDLE, ABSBOTTOM. The tabindex setting defines in which order the different fields should be activated when the visitor clicks the tab key.

22 IMAGE BUTTON Image buttons have the same effect as submit buttons. When a visitor clicks an image button the form is sent to the address specified in the action setting of the tag. image name= src= align= border= width= height= vspace= hspace= tabindex=

23 Defines a label to a control. If you click the text within the label element, it is supposed to toggle the control.


Download ppt "FORMS. Forms are used to receive information from the web surfer, such as: their name, email address, credit card, etc. Form fields are objects that allow."

Similar presentations


Ads by Google