Sunteți pe pagina 1din 5

FORMS , INTERACTIVITY , AND DATABASE

ABSTRACT Forms
HTML forms are used to get information from the user. Users either type in the information or they select from a list of pre-set options. Here is a simple example (Note: This form is nonfunctional. You can type in it, but you can't submit it anywhere): Who are you? Where are you from? Do you prefer green or yellow? green yellow Why is the sky blue?

Here is the code for this particular form:


<form id="sample_form" method="post" action=""> <p> <label for="who">Who are you?</label> <input type="text" name="who" id="who" />

</p> <p> <label for="where">Where are you from?</label> <input type="text" name="where" id="where" /> </p> <fieldset> <legend>Do you prefer green or yellow?</legend> <p> <input name="color" type="radio" value="green" id="green" /> <label for="green">green</label> </p> <p> <input name="color" type="radio" value="yellow" id="yellow" /> <label for="yellow">yellow</label> </p> </fieldset> <p> <label for="textarea">Why is the sky blue?</label><br /> <textarea name="textarea" cols="30" rows="5" id="textarea"></textarea> </p> </form>

I'm not going to go into great details here about the accessibility features of forms, because the reading materials do a pretty good job of that. You should refer to them for more information. One thing not covered in a lot of detail, though, is the basic information on how forms work, so let me talk about that for just a second.

How Does a Form Work?


Setting up a form is relatively easy, especially if you use a program like Dreamweaver. But how do you make a form work? How do you get a form to do something? The answer to these questiones depends on what you want a form to do. Forms are most commonly used to do the following two types of actions: 1. save information to a database 2. send an email to someone There are other things that you could do with forms, but there are by far the most common. Unfortunately, to do either of those things, somebody has to write a script to perform these functions, and it would go way beyond the scope of this class to teach you how to do that. Scripts can be written in such languages as PHP, JSP, Perl, Python, ASP, Cold Fusion, or others. The script tells the server what to do with the information once it is submitted. Should the information be sent in an email? If so, to whom? Should the information be sent to a database? If

so, to which database? How should the data be handled? What happens if someone submits a bad email address? Should the user see an error message? What about when users forget to fill in important elements of a form? These are usually not small issues. It takes time to set this up and to do it right. The illustration below shows how most forms are set up to work:

The user fills out the information in the form. This information is sent to a script. The script determines whether or not there are errors. If there are no errors, the script processes the data by either sending an email to someone or by inserting it in a database somewhere. Then the script presents the user with a confirmation message. If there are errors, the script presents an error message, and usually sends the user back to the form to try again.

Interactivity
Most web sites are not very interactive. They have links, but not much more than that. Links are interactive (because users click on them in order to access other content), but they're easy to make accessible, so they're not really a big problem most of the time. When I use the term "interactive," I'm referring to items that require scripting (programming) of some sort. This week's lesson focuses on HTML forms and JavaScript. In a future lesson we'll also look at multimedia and Flash, though we won't go into great detail with these other technologies. You could easily spend a whole courseor several courseslearning any of them. Interactivity on web sites can make them more engaging, more useful and more fun in a lot of ways. Unfortunately, some types of interactivity are not so good for accessibility. When using a screen reader, one of the problems with interactivity is that users don't know when something has changed on a web page. They can't see the change, and there is no built-in way in HTML to notify users of changes to the interface or to the document. Even if the changes are "accessible," it does little good if users are unaware that the changes even occurred.

For example, a web site might have a link that users can click on (or hover over with their mouse) to make a sub-menu appear. Sighted users can see the sub-menu appear, but blind users cannot. Even if the menu itself is accessible to a screen reader, nothing happens to alert the user that the sub-menu has appeared. As far as the user knows, nothing happened after clicking on the link. This can be frustrating. Keyboard accessibility is also an issue. If a web site uses "drag and drop" functionality that requires a users to move objects with the mouse, people who use the keyboard will not be able to use this feature. This does not mean that sub-menus and "drag and drop" functionality are completely "against the rules." You can use them, but you have to ensure that users are made aware of changes in the interface, and make sure that there is more than one way to access the information (e.g. with both the keyboard and the mouse).

S-ar putea să vă placă și