Forms - Forms 5/25/10 2:25 PM Forms General Info Allow you...

Info iconThis preview shows pages 1–3. Sign up to view the full content.

View Full Document Right Arrow Icon
5/25/10 2:25 PM Forms Page 1 of 10 http://www-rcf.usc.edu/~trinagre/itp104/lectures/Forms.html Forms General Info Allow you to collect information from users. A form is an area that can contain form elements. Form elements are elements that allow the user to enter information (like textfields, textarea fields, drop-down menus, radio buttons, checkboxes, etc.) in a form. The <form> element defines the form, and all form input elements are nested inside it. Four main tags: form input textarea select input are main form elements, and include text boxes, radio buttons, checkboxes and buttons. The <input> element can act as many different input controls on the web page depending on the value of its type attribute. A type of "text" creates a single line text input. A type of "submit" creates a submit button. A type of "radio" creates one radio button. All radio buttons with the same name make up a group of mutually exclusive buttons. A type of "checkbox" creates one checkbox control. YOu can create a set of choices by giving multiple checkboxes the same name . Each element has a name attribute to match the data entered or selected by the user with the element. A <textarea> element creates a multi-line text input area. If you put text into the content of a <textarea> element, it will become the default text in a text area control on the web page. A <select> element creates a menu, which contains one or more <option> elements. They defince the items in the menu. Forms are given "actions" that define where the form (and its data) will be sent when a person completes the form and submits it. Generally, forms are sent to scripts that process the content of forms, such as placing that information in a database or formatting and e-mailing the information to someone.
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
5/25/10 2:25 PM Forms Page 2 of 10 http://www-rcf.usc.edu/~trinagre/itp104/lectures/Forms.html The action attribute contains the URL of the Web Application. The method attribute contains the method of sending the form data: either POST or GET. A POST packages form data and sends it as part of the request. Use POST when the form data should be private, or when it is large, such as when a <textarea> or file <input> element is used. A GET packages form data and appends it to the URL. Use GET for requests that might be bookmarked. When a web form is submitted, the form data values are paired with their corresponding names, and all names and values are sent to the server. A form is defined with the <form> tag. Many elements will be within one form tag. <form> <input /> <input /> </form> Input The most used form tag is the <input> tag. The type of input is specified with the type attribute. The most commonly used input types are explained below. Text Fields
Background image of page 2
Image of page 3
This is the end of the preview. Sign up to access the rest of the document.

Page1 / 10

Forms - Forms 5/25/10 2:25 PM Forms General Info Allow you...

This preview shows document pages 1 - 3. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online