FORMS (Chapter 10 and Chapter 12)

 

Forms & Form Processing.

Form - a tool for collecting and delivering data from the user.

Forms and form types are what we will cover. Form processing and  CGI scripts we will not.

Tags

<form> </form>

Two NECESSARY attributes  action & method

action="mailto:YourPittAccountName@pitt.edu"

- action points to the application that will process the data captured by the form.

method="post"

-can equal "get" or "post"

get: With the HTTP "get" method, the form data set is appended to the URI specified by the action attribute (with a question-mark ("?") as separator) and this new URI is sent to the processing agent.

post: With the HTTP "post" method, the form data set is included in the body of the form and sent to the processing agent.

The "get" method should be used when the form causes no side-effects. Many database searches have no visible side-effects and make ideal applications for the "get" method.

If the service associated with the processing of a form causes side effects (for example, if the form modifies a database or subscription to a service), the "post" method should be used.

- method tells the browser how to send the data to the server.

- "mailto:" always requires "post"

input tag - creates an input element (control) within a form

<input />

important attributes:  name, value, type

name - required by most input controls

type - defines which input control you will provide to the user.

value - assign a default value to the field.

simple form

 

control types -

button - control that has no predefined funtion

text - allows the user to submit typed text.

checkbox - allows for multiple selections in a series.

file - sending an entire file

radio - button that ensures only one selection is made

submit - activates the coding as submission process of the browser or invokes the associated a-mail application.

reset - clear selections

Drop Down list boxes

Select tag - creates a list box made up of enclosed elements.

Note: If you want to have multiple selections use the keywords "select multiple" such as in the following example:

<select multiple id=Topics[] name=Topics[] size=20>
<option value="Visual Languages;">Visual Languages</option>


attributes: name, size, style, multiple

*must contain at least one <option> </option> tag (element).

 

 

 

 

 

 

Further reading about forms