Exercise 5 - WWW forms

In the following exercises you will make a www form that can be used for surveying TV watching habits. Different properties of the forms will be tested so you should think of every field: Could it be done in a better way? Lecture 8 gives some ideas and hints.

  1. Copy this HTML code and use it as a base for your form page. The elements that are defined in the exercises belong inside the form elemet. Note that the following is already defined:
    <?xml version="1.0" encoding="ISO-8859-1"?>
    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN" 
      "http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
    <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="fi">
    <head>
    <title>Example form</title>
    </head>
    <body>
    <h1></h1>
    <form action="http://appro.mit.jyu.fi/cgi-bin/laheta/laheta.cgi" 
      method="post">
    
    </form>
    </body>
    </html>
    
  2. Create six single lined text fields (text) for asking the user's

    Use the label element as a title for the fields and connect label and the field!

  3. Save and validate the form page before continuing.
  4. Use radiobutton for asking the gender of the user (radio). The options are for example:

    Use the browser to check if the button works. If you are able to select more than one button at a time check the values of the name attribute!

  5. Ask the age of the user using a radiobutton (radio). The options are for example:

    Are there other possibilities for asking the age? What are they and how do they work from the user's point of view?

  6. Ask the marital status using a checkbox (checkbox). The options are for example:

    Are there other possibilities for asking the marital status? What kind of problems the checkbox brings?

  7. Set one element from the checkbox as a default (checked).
  8. Ask the language skills by a checkbox (checkbox). The options are for example:
  9. Ask the education by using a select box (select). For options use for example:
  10. Then put a submit button on the form (submit) and test its function. If the form works as it is supposed to, you will after submitting the form see a page that thanks for ordering and lists the names and values of all the submitted fields.
  11. For asking the times the user watches TV use multiple select box (multiple) (select). The options are for example:
  12. Set one of the options as a default (selected).
  13. Ask the favorite programme by a select box (select). For separating the programmes on different channels use the optgroup element. Use different browsers to see how optgroup works. Use for example the following options:
  14. Put a multiple lined text field to the end (textarea) for comments on the enquiry.
  15. Try the form and make sure all the values of the fields appear correctly on the thanks page. The data from the form is also sent to you by e-mail so check your inbox between the tasks.
  16. Group the questions using the fieldset element and set titles for the groups using the legend element. Put the personal details to a distinct group, for instance.
  17. Now you will edit the the function of the programme that processes the data by using the following properties of hidden fields (hidden). Try the form after every change you make. More spesific instructions are available in the cgi instructions.
  18. Validate your form.
  19. Check the accessibility by Bobby.

Additional exercises

  1. Define a different tabulation order for the fields by the tabindex attribute and use different browsers to see how it works.
  2. Define accesskeys to the titles of the fields using the accesskey property. Again test the function in different browsers.
  3. Format the appearance of the form using the stylesheet and look at the appearance in different browsers.
http://appro.mit.jyu.fi/2001/syksy/tietoverkot/demot/demo5/index.html
© Petri Heinonen ()<URL: http://www.mit.jyu.fi/peheinon/>
4.10.2001 14:55:08