MacBoy's
Super Simple FORM TUTORIAL
for GeoCities, Part 3:
Buttons and one more neat trick


Let's do the cool stuff first

Adding radio buttons and checkboxes isn't really all that hard, but it does start to get us a bit beyond a "super simple" form. So we'll look at one more neat trick that you should have on even a very simple form, then start in the the other stuff.


The neat trick

You've seen it, you've had it work for you when you filled in someone else's form, and now you want it on your page, too.

"MacBoy, how do I get someone who's filled in the form to go to my special "Thank You" page automatically? That boring grey automatic page is DULL, DULL, DULL! And I don't know if they'll come back!"

It's the NEXT-URL Tag! Again, it's hardly complicated. However, it's picky about the URL you include. This is the tag:

<input type="hidden" name="next-url" value="http://www.oocities.org/SiliconValley/Vista/4555/sent.html">

Placed above or below the "submit" buttons, this tag will send the form-filler-upper to a page called "sent.html" where they'll be greeted with the usual "Thanks for filling in the form, it's on it's way now" type of stuff. You'll need to design your own "Thank You" page, of course. This might also be a link back to your main page or the next page, and a note saying they can always use their browser's back button to fill the form out again. This way, they wont feel they've "left your site" and go on somewhere else. You could just as easily send them off to Disney.com if you wanted, or directly to the next page in your site. Your choice.

Just be certain the COMPLETE URL (that means the http://www..... part and so on) is included, or else the entire form WILL NOT WORK!!

DO NOT use just the file name that's in your directory (ie: value="sent.html") like you would in a normal link, because the server is in the CGI bin (that's where it's grabbing the "how to handle forms" instructions) which is somewhere else, so it needs the complete address.


Choices, choices...

Say you want the reader to tell you what, from a list you show them, they like or use. Easy ways are by using Checkboxes and Radio Buttons. (Pull Down Lists and Scroll List will be covered on the next page.)
Each of these has a different use, not just a different look. Let's look at them.


The Checkbox

You use this when you want to let the reader choose a "yes" (cliked) or "no" (not clicked) sort of response to the question.
So, let's take, for example, ICE CREAM! We're offering 5 different flavours today. Check boxes would be useful for the following:

Choose as many flavours as you like:
Chocolate/Chocolate Chip
Peanut Brittle/Vanilla
Cookie Batter
Vanilla/Blueberry
Caramel Swirl

As you see, this lets the reader choose none, two, four, all of them, whatever.

Let's look at the code:

Choose as many flavours as you like:<br>
<input TYPE="checkbox" NAME="Chocolate">Chocolate/Chocolate Chip<br>
<input TYPE="checkbox" NAME="Peanut">Peanut Brittle/Vanilla<br>
<input TYPE="checkbox" NAME="Cookie">Cookie Batter<br>
<input TYPE="checkbox" NAME="Blueberry">Vanilla/Blueberry<br>
<input TYPE="checkbox" NAME="Caramel">Caramel Swirl<br>

If someone were to choose three of these flavours, this is what the email would look like:

(Chocolate) on
(Cookie) on
(Blueberry) on

Now there's no reason you can't have the boxes run this way. Just change the use of the <br> line breaks.

Choose as many flavours as you like:
Chocolate/Chocolate Chip Peanut Brittle/Vanilla Cookie Batter
Vanilla/Blueberry Caramel Swirl

But if this list were much longer, it could get confusing, not to mention messy looking. Do you click the box on the RIGHT or the LEFT of "Peanut Brittle"? Use whatever looks best and is easy to understand.


Radio Buttons

These are similar to Checkboxes, except that they give you ONE choice out of several.

Choose your FAVOURITE flavour:
Chocolate/Chocolate Chip
Peanut Brittle/Vanilla
Cookie Batter
Vanilla/Blueberry
Caramel Swirl

The code for this one is:

Choose your FAVOURITE flavour:<br>
<input TYPE="radio" NAME="Favourite Flavour" VALUE="Chocolate">Chocolate/Chocolate Chip<br>
<input TYPE="radio" NAME="Favourite Flavour" VALUE="Peanut">Peanut Brittle/Vanilla<br>
<input TYPE="radio" NAME="Favourite Flavour" VALUE="Cookie">Cookie Batter<br>
<input TYPE="radio" NAME="Favourite Flavour" VALUE="Blueberry">Vanilla/Blueberry <br>
<input TYPE="radio" NAME="Favourite Flavour" VALUE="Caramel">Caramel Swirl<br>

Notice that the NAME= is now "Favourite" for ALL of the buttons, and we've added VALUE="the flavour". This causes the server to allow just the one choice to return as "favourite", and places whatever flavour was checked in that line in the e-mail. So here's the e-mail received:

(Favourite Flavour) Cookie


Pre-selecting

Sometimes, you may want to have one of the buttons or boxes highlighted already, as a default choice, to make people either follow your lead or perk their minds up before just accepting the choices.
So here's how you would get this:

Which show would you rate as "Best Comedy"?
Friends
Seinfeld
Ellen
Martin County Farm Report

What activities do you enjoy?
Going to the Movies
Cleaning the sock drawers
Eating at a good restaurant
Relaxing at the cottage

To pre-select one button or several checkboxes, add "checked" to that line's code:

<input TYPE="radio" NAME="Best Comedy" VALUE="Ellen" checked>Ellen<br>

<input TYPE="checkbox" NAME="Cleaning Sox" checked>Cleaning the sock drawers<br>


And off to the Lists!

So next we'll look at the last part of our tutorial... let's zip on right over there!


Front Page | Before we start...
PART ONE: The Basic Form | PART TWO: What Happens
PART THREE: Form Buttons | PART FOUR: Lists
Survey Form | What You've Said...
F.A.Q.: Troubleshooting

Need More Help?

If you need further help with your form, visit the Counters, Forms & Imagemaps Help Forum. Please read the posts that are already up to make sure your question has not already been asked and answered. If you don't see your question covered already, just add it in, making CERTAIN that you add the URL to the problem form, if it's in your directory.

LinkExchange
LinkExchange Member Free Home Pages at GeoCities

© 1997 MacBoy