Helping ordinary people create extraordinary websites!
HOME TUTORIALS SCRIPTS WEB HOSTING BLOG FORUM
Get Our Newsletter
Email:

Changing Form Action URLs On-The-Fly

By Will Bontrager
2003-09-03


Introduction

Sometimes a person just needs to be able to do more with a form.

Today, I'll show you how to change the action="_____" URL on-the-fly, depending on which (if any) radio button is checked by the form user. Drop-down lists could be substituted for radio buttons.

You might not need such functionality for your site at the present time. But when you need it, you'll really need it.

For example, if you use the free Master Feedback from http://willmaster.com/a/20t/pl.pl?msmf to handle your forms, you may want to have the form results sent to a different address under certain conditions. Or, you may want a different "thank you" page. Depending on your particular implementation, you might even want to change the form's method="_____" value.

This article shows you how.

(The Master Form V3 CGI program from http://willmaster.com/a/20t/pl.pl?mfV3 already allows multiple emails, choice of database formats, and choice of "thank you" pages. If you already have Master Form V3 on your site, you probably won't need to add this functionality.)

Using the method described here, you would have more than one copy of Master Feedback installed. The installed scripts can have different file names, or they can be installed in different cgi-bin subdirectories.

Without getting into a description of every nuance, there are nevertheless several things that need to be mentioned for a good understanding of how to implement this feature into your site. Each mention will have examples of code, HTML or JavaScript.

At the end of this article is the entire example.

Tutorial Pages:
» Introduction
» Mention #1
» Mention #2, 3 & 4
» Method #5
» Mention #6
» The Complete Example


Copyright 2004 Bontrager Connection, LLC


 | Bookmark
Related Tutorials:
» JavaScript Debugging Techniques with Firebug
» Striped Tables Using JavaScript
» Opening PDFs in a New Window with JavaScript
» Essential Javascript -- A Javascript Tutorial
» Submit Forms Conditionally using JavaScript
» How to Setup a Randomising Function