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


Method #5

The JavaScript function must return a true value. Otherwise, the browser won't submit the form. Thus, you'll find

return true;

as the last line of the JavaScript function.

If you have a long list of radio button values to check, over a dozen or two, for example, then you might insert the

return true;

line as the last line of each if(...) statement. That would allow the JavaScript return as soon as a match is made and not have to check the rest of the if(...) statements.

Example:

if(document.myform.reason[0].checked == true) {
document.myform.action = '/cgi-bin/mf1.cgi';
return true;
}


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

Ask A Question
characters left.