Re: (no subject) (submit and redirect)

by Thomas James Allen <tjallen(at)pipeline.com>

 Date:  Tue, 07 Sep 1999 23:15:31 -0400
 To:  MNWybs(at)aol.com
 Cc:  hwg-basics(at)hwg.org
  todo: View Thread, Original
At 07:46 AM 9/7/99 -0600, you wrote (I edited):
>Hi all!  I am trying to 
>create your basic form but I would like to link to another page when the 
>Submit button is pressed.
-----------------------------------

Okay, I've tried this on NN4.6 and it seems to work, 
but if you can't get it to work, write and let me know.

First, name your form. Here (below) I used "fred"
Keep your action and method just as you had it on your page.

Second, instead of a submit button, use a regular input button
that has an onClick, which calls a javascript function, 
which I named "goThere()"
This gives you something like this:

--------------------------
<form name="fred" action="whatyouhadhere" method="post">
.
all your form stuff
.
.
<input type="button" value="submit" onClick="goThere()">
</form>
------------------------

Finally, in the HEAD section of your document,
put this javascript function:

<script language="JavaScript">
<!-- hide the js
function goThere(){
document.fred.submit();
location.replace("newpage.html");
}
// stop hiding-->
</script>

This javascript first submits fred,
then redirects the browser to a new page.
(insert the name of your new page there.)

Note: the program you have in the form action="whatever"
might try to send a thank-you page, 
and that might mess this up, I don't know.

Hope this helps,
jimmy
---
www.getyourwebsitehere.com
www.getyourwebsitehere.com/personal

HTML: hwg-basics mailing list archives, maintained by Webmasters @ IWA