Main Page/Previous Lesson/Next Lesson

Checkbox Forms

Check boxes are used when your user must choose zero, one, or more items from a list of several items. A checkbox has a description and a box to the right of the description. Here is one useful example. When checked the box shows a check mark.

To set up a check box use the < form > tag pair and insert the following < input > tag:

< input type=checkbox name=groupname value=nameofcheckbox >

name=attribute is the attribute used for the general list, value= attribute is the specific item checked. Both will appear in the email that comes to you from the form.

The checked=checked attribute lets you set up default values in your check boxes.

Example:
< form >

< br >< br >Please select your favourite foods:
< br >< br >< input type=checkbox name=foods value="Potatoes" > Potatoes
< br >< input type=checkbox name=foods value="Chocolate" > Chocolate
< br >< input type=checkbox name=foods value="Pizza" > Pizza
< br >< input type=checkbox name=foods value="Peanut butter" checked=checked > Peanut butter
< br >< input type=checkbox name=foods value="Tacos" > Tacos
< br >< input type=checkbox name=foods value="Ice cream" > Ice cream

< / form >



Please select your favourite foods:

Potatoes
Chocolate
Pizza
Peanut butter
Tacos
Ice cream

If the user selects all the foods, then the values that the form will produce will look as follows:

foods=Potatoes
foods=Chocolate
foods=Pizza
foods=Peanut butter
foods=Tacos
foods=Ice cream

Radio Buttons

NOTE: In older cars, radio had push buttons that selected one and only one radio station at a time. When you pushed one button in, whatever button that was preciously pushed in popped out. Radio buttons in forms work the same way.

The user can only select one radio button from a group of radio selections, but you may display more then one group of radio button groups on one page.

Set up a radio button inside a < form > tag pair using the < input > and type=attribute

Example radio buttons:
< form >

< b >1. Which is correct, the yolk of an egg Is white or the Yolk or an egg Are white?< / b >
< br >
< input type=radio name=choice1 value="is" > Is
< br >
< input type=radio name=choice1 value="are" > Are
< br >
< input type=radio name=choice1 value="rucrazy" > Are you crazy?
< br >
< input type=radio name=choice1 value="dontlike" > I don't like eggs.

< p >

< b >2. Do you like ice cream?< / b >
< br >
< input type=radio name=choice2 value="yes" > Yes
< br >
< input type=radio name=choice2 value="no" > No
< br >
< input type=radio name=choice2 value="depends" > It depends...
< br>
< input type=radio name=choice2 value="2personal" > That's to personal.

< / form >

1. Which is correct, the yolk of an egg Is white or the yolk or an egg Are white?
IS
Are
Are you crazy?
I don't like eggs.

2. Do you like ice cream?
Yes
No
It depends...
That's too personal.

Selection Lists

Selection lists, are also known as dropdown lists, scrolling lists, pick lists, and pull-down lists depending on their style. Theses lists can take up very little screen space, and still give many options for the user to select,

To set up a selection list on your form, use the < select > and < / select > tags. The < select > tag informs the browser that a selection list is about to appear. You should use the name=attribute and specify a size=attribute to determine how many items appear visibly on the screen. Theses kinds of selection lists have scroll bars so that the user can scroll to pick the items they want.

Each item must appear between a < option > and < / option > tag pair. If you want to allow many selections, use the multiple=multiple attribute.

Example:
< form >
< b >Favourite Ice cream Flavours< / b >
< p >

< select name=ice cream size=4 multiple=multiple >

< option >Cappuccino and expresso< / option >
< option >Cherries jubilee< / option >
< option >Chocolate chip< / option >
< option >Chocolate chip cookie dough< / option >
< option >Chocolate fudge< / option >
< option >French vanilla< / option >
< option >Golden medal ribbon coffee< / option >
< option >Jamoca< / option >
< option >Almond fudge< / option >
< option >Mint chocolate chip< / option >
< option >Nutty coconut< / option >
< option >Old fashioned butter pecan< / option >
< option >Oreo cookies and cream< / option >
< option >Peanut butter and chocolate< / option >
< option >Pistachio and almond< / option >
< option >Pralines and cream< / option >
< option >Reese's peanut butter cup< / option >
< option >Rocky road< / option >
< option >Strawberry cheesecake< / option >
< option >Vanilla< / option >
< option >Very berry strawberry< / option >
< option >World class chocolate< / option >
< option >Baseball nut< / option >
< option >Blue raspberry sherbert< / option >
< option >Chunky banana< / option >
< option >Divine cherry cheesecake< / option >
< option >Dulce de leche< / option >
< option >Peachy keen sherbert< / option >
< option >Pearls of praline< / option >
< option >Rainbow sherbert< / option >
< option >Red raspberry sherbert< / option >
< option >Tin roof sundae
< / select >

< / form >

Favourite Ice cream Flavours

NOTE:In order to select more than one option the user must hold down "control" as they click on the items they select.

Pick Lists

Use a pick list when you:

  • Want to devote only one line of the screen for the entire list
  • when you want the user to only select one item

    Example:
    < form >
    < b >Favourite Colour< / b >
    < p >
    < select name=color size=1 >
    < option >white< / option >
    < option >pink< / option >
    < option >red< / option >
    < option >orange< / option >
    < option >yellow< / option >
    < option >green< / option >
    < option >blue< / option >
    < option >purple< / option >
    < option >grey< / option >
    < option >black< / option >
    < option >brown< / option >
    < option >silver< / option >
    < option >gold< / option >
    < / select >
    < / form >

    Favourite Colour

    NOTE: Pick lists are often used for the user to choose which state they live in.

    Submitting Forms

    You should supply a submit button at the bottom or on the side of your form so your user can click to process what they have filled in.

    In case the user suddenly decides not to send the form, or to change all the information of the form, it is useful to have a clear or reset button which sets all the values back to their initial default values.

    The submit button sends information to you using the CGI or your email.

    To place the submit button use the command using the < input > tag. Include the type= attribute and the value= attribute.

    Example:
    < input type=submit value="Done" >

    Like the Send button, the reset button used the < input > tag with the type= attribute and the value= attribute.

    Example:
    < input type=reset value="Reset Form" >

    NOTE: Be careful where you put the reset button, users do not always read before clicking, and if it is at the bottom or neat the send button they may click the wrong button. Put the reset button in a place they are not likely to click thinking it is the send button.


    Main Page/Previous Lesson/Next Lesson

































    Hosted by www.Geocities.ws

    1