Chapter 8 - Working with Forms
Form Creation
First you should add form tag. The form tag has several attributes which will allow you to modify how the form works. - pg 186
- name - used if you are using JavaScript to modify the tags
- action - the location (URL) of the form processor
- method - how information will be sent from one location another
- get - the form information is placed into the URL of the processor.
ex: http://access2learn.com/form.php?name=walter+wimberly
This also runs the risk of making the URL too long, as URLS can only be 4,000 characters total.
It also makes things like passwords unsafe as they are posted in clear view to anyone look over the shoulder - post - the form information is placed into the http headers so they aren't seen by people.
- get - the form information is placed into the URL of the processor.
The form tag <form> and closing tag </tag> must surround all of the form elements. This is how it knows what information to send to the form processor.
Form Elements
Form Accessibility - pg 187, we'll see it in action in a second as we build forms. Can limit the number of characters shown, as well as what can be entered.
Text Fields - uses the input tag. The type attribute is "text", which is the default value, if one is not entered
Labels - are used to allow easier navigation for those who have visual or motor impairments
Fieldsets - are used to group related items together - usually a box surrounds them, and a legend tag can be used to give the grouping a title
Password Fields - also use the input tag. The type attribute is "password"
Text Areas - uses an open and close textarea tag. Can specify a height (rows) and width (columns) for this tag. Good for freeform feedback.
Radio Buttons - allow for only one out of a group of objects to be shown
Checkboxes - allow for yes/no responses
Lists - come as either "Lists" or "Menus" - this is based upon Dreamweaver's notation - it is actually the same tag.