By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
459,472 Members | 1,222 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 459,472 IT Pros & Developers. It's quick & easy.

Simple question I hope!

P: n/a
Hi
I want to write a form that when a user presses submit it carries out the
submit action and then closes the browser or redirects to another page.

The form CGI I'm using, Demon's does not allow this and the default page and
message is , well, crap!

Can this be done?

Thanks

Adrian
Jul 20 '05 #1
Share this Question
Share on Google+
10 Replies


P: n/a
Yes, it can be:

Part I

<!--- test.html --->
<html>
<head>
<title>Test</title>
</head>
<body>
<form name="adrianFrm" action ="/cgi-bin/myscript.cgi" method = "post">
<input type = "submit" value = "Send">
</form>
</body>
</html>

Part II

<!--- mysqcript.cgi --->
<!--- make sure your script outputs the following --->
<html>
<head>
<title>Test</title>
<meta name = "http-equiv" content = "0;url=http://www.mysite.com/">
</head>
<body>
<p>Click here to <a href = "http://www.mysite.com/">continue</a></p>
</body>
</html>

Adrian wrote:
Hi
I want to write a form that when a user presses submit it carries out the
submit action and then closes the browser or redirects to another page.

The form CGI I'm using, Demon's does not allow this and the default page and
message is , well, crap!

Can this be done?

Thanks

Adrian


Jul 20 '05 #2

P: n/a
Hi
Thanks, but I my isp provide a preset script that I can't modify only
call, so I'm trying to do it from JS within the page!

Adrian

"orlando echevarria" <or*****@engr.uconn.edu> wrote in message
news:3F**************@engr.uconn.edu...
Yes, it can be:

Part I

<!--- test.html --->
<html>
<head>
<title>Test</title>
</head>
<body>
<form name="adrianFrm" action ="/cgi-bin/myscript.cgi" method = "post">
<input type = "submit" value = "Send">
</form>
</body>
</html>

Part II

<!--- mysqcript.cgi --->
<!--- make sure your script outputs the following --->
<html>
<head>
<title>Test</title>
<meta name = "http-equiv" content = "0;url=http://www.mysite.com/">
</head>
<body>
<p>Click here to <a href = "http://www.mysite.com/">continue</a></p>
</body>
</html>

Adrian wrote:
Hi
I want to write a form that when a user presses submit it carries out the submit action and then closes the browser or redirects to another page.

The form CGI I'm using, Demon's does not allow this and the default page and message is , well, crap!

Can this be done?

Thanks

Adrian

Jul 20 '05 #3

P: n/a
I want to write a form that when a user presses submit it carries out the
submit action and then closes the browser or redirects to another page.


If I understand you correctly, then you want the form processing to be done
on the page locally, rather than on the server?

If so... well... It is possible to write a javascript function to 'validate'
the form and perform pretty much any 'local' operations of the info...
However, usually for a form to be of any use it needs to send its data to
the server.

If all you want to do is rewrite the form in a fancy way so that it looks
nice, you can do that and still submit the form data to the cgi script.
However, getting it to redirect to another page after submission is another
matter... I'm pretty sure that you cannot change that behaviour, as upon
processing the cgi script, its output is sent to the browser directly. So
unless you can modify the cgi script, you're stuck. Unless there is a
parameter you can pass to the cgi script that will redirect it somewhere.
Which is doubtful.

HTH.

P.
Jul 20 '05 #4

P: n/a
Hi
Thanks, the redirect in your second scenario is what I'm trying to
achieve or if not a redirect, to submit the from and then close the window
before it receives a reply.

Thanks

Adrian
"The Plankmeister" <pl******************@hotmail.com> wrote in message
news:3f***********************@dread16.news.tele.d k...
I want to write a form that when a user presses submit it carries out the submit action and then closes the browser or redirects to another page.
If I understand you correctly, then you want the form processing to be

done on the page locally, rather than on the server?

If so... well... It is possible to write a javascript function to 'validate' the form and perform pretty much any 'local' operations of the info...
However, usually for a form to be of any use it needs to send its data to
the server.

If all you want to do is rewrite the form in a fancy way so that it looks
nice, you can do that and still submit the form data to the cgi script.
However, getting it to redirect to another page after submission is another matter... I'm pretty sure that you cannot change that behaviour, as upon
processing the cgi script, its output is sent to the browser directly. So
unless you can modify the cgi script, you're stuck. Unless there is a
parameter you can pass to the cgi script that will redirect it somewhere.
Which is doubtful.

HTH.

P.

Jul 20 '05 #5

P: n/a
If you are using the formail.pl script, the hidden field is "redirect".

Eric Klein
er********@mssm.edu
http://www.mssm.edu/students/kleine04
"The Plankmeister" <pl******************@hotmail.com> wrote in message news:<3f***********************@dread16.news.tele. dk>...
Unless there is a
parameter you can pass to the cgi script that will redirect it somewhere.
Which is doubtful.

HTH.

P.

Jul 20 '05 #6

P: n/a
If you are using formail.pl, the hidden field is called "redirect".

Eric Klein
<a href="mailto:er********@mssm.edu>er********@mssm.e du</a>
<a href="http://www.mssm.edu/students/kleine04">http://www.mssm.edu/students/kleine04</a>
"The Plankmeister" <pl******************@hotmail.com> wrote in message news:<3f***********************@dread16.news.tele. dk>...
I want to write a form that when a user presses submit it carries out the
submit action and then closes the browser or redirects to another page.


If I understand you correctly, then you want the form processing to be done
on the page locally, rather than on the server?

If so... well... It is possible to write a javascript function to 'validate'
the form and perform pretty much any 'local' operations of the info...
However, usually for a form to be of any use it needs to send its data to
the server.

If all you want to do is rewrite the form in a fancy way so that it looks
nice, you can do that and still submit the form data to the cgi script.
However, getting it to redirect to another page after submission is another
matter... I'm pretty sure that you cannot change that behaviour, as upon
processing the cgi script, its output is sent to the browser directly. So
unless you can modify the cgi script, you're stuck. Unless there is a
parameter you can pass to the cgi script that will redirect it somewhere.
Which is doubtful.

HTH.

P.

Jul 20 '05 #7

P: n/a
Hi,
Thanks but I guess its not formail.pl as redirect didn't work!

The form tag is :
<form action="/cgi-bin/mailform" method="get">

And the ISP is www.demon.net

if that helps

Thanks

Adrian

"Eric Klein" <er********@mssm.edu> wrote in message
news:16**************************@posting.google.c om...
If you are using formail.pl, the hidden field is called "redirect".

Eric Klein
<a href="mailto:er********@mssm.edu>er********@mssm.e du</a>
<a href="http://www.mssm.edu/students/kleine04">http://www.mssm.edu/students/kl
eine04</a>

"The Plankmeister" <pl******************@hotmail.com> wrote in message

news:<3f***********************@dread16.news.tele. dk>...
I want to write a form that when a user presses submit it carries out the submit action and then closes the browser or redirects to another
page.
If I understand you correctly, then you want the form processing to be done on the page locally, rather than on the server?

If so... well... It is possible to write a javascript function to 'validate' the form and perform pretty much any 'local' operations of the info...
However, usually for a form to be of any use it needs to send its data to the server.

If all you want to do is rewrite the form in a fancy way so that it looks nice, you can do that and still submit the form data to the cgi script.
However, getting it to redirect to another page after submission is another matter... I'm pretty sure that you cannot change that behaviour, as upon
processing the cgi script, its output is sent to the browser directly. So unless you can modify the cgi script, you're stuck. Unless there is a
parameter you can pass to the cgi script that will redirect it somewhere. Which is doubtful.

HTH.

P.

Jul 20 '05 #8

P: n/a
for mailform the hidden field should be _1_SuccessDocument
good luck

Eric Klein
er********@mssm.edu
http://www.mssm.edu/students/kleine04
"Adrian" <Ad*************@NOSPAMhotmail.com> wrote in message news:<bk*******************@news.demon.co.uk>...
Hi,
Thanks but I guess its not formail.pl as redirect didn't work!

The form tag is :
<form action="/cgi-bin/mailform" method="get">

And the ISP is www.demon.net

if that helps

Thanks

Adrian

"Eric Klein" <er********@mssm.edu> wrote in message
news:16**************************@posting.google.c om...
If you are using formail.pl, the hidden field is called "redirect".

Eric Klein
<a href="mailto:er********@mssm.edu>er********@mssm.e du</a>
<a

href="http://www.mssm.edu/students/kleine04">http://www.mssm.edu/students/kl
eine04</a>


"The Plankmeister" <pl******************@hotmail.com> wrote in message

news:<3f***********************@dread16.news.tele. dk>...
> I want to write a form that when a user presses submit it carries out the > submit action and then closes the browser or redirects to another page.
If I understand you correctly, then you want the form processing to be done on the page locally, rather than on the server?

If so... well... It is possible to write a javascript function to 'validate' the form and perform pretty much any 'local' operations of the info...
However, usually for a form to be of any use it needs to send its data to the server.

If all you want to do is rewrite the form in a fancy way so that it looks nice, you can do that and still submit the form data to the cgi script.
However, getting it to redirect to another page after submission is another matter... I'm pretty sure that you cannot change that behaviour, as upon
processing the cgi script, its output is sent to the browser directly. So unless you can modify the cgi script, you're stuck. Unless there is a
parameter you can pass to the cgi script that will redirect it somewhere. Which is doubtful.

HTH.

P.

Jul 20 '05 #9

P: n/a
Hi Eric,
I have tried:
<input type="hidden" name="_1_SuccessDocument"
value="http://uk.altavista.com/">
<input type="hidden" name="_1_SuccessDocument" value="index.htm">

Neither had changed the page displayed! did I enter them correctly? If so I
guess demon have tweaked their script!

Thanks

Adrian
"Eric Klein" <er********@mssm.edu> wrote in message
news:16**************************@posting.google.c om...
for mailform the hidden field should be _1_SuccessDocument
good luck

Eric Klein
er********@mssm.edu
http://www.mssm.edu/students/kleine04
"Adrian" <Ad*************@NOSPAMhotmail.com> wrote in message

news:<bk*******************@news.demon.co.uk>...
Hi,
Thanks but I guess its not formail.pl as redirect didn't work!

The form tag is :
<form action="/cgi-bin/mailform" method="get">

And the ISP is www.demon.net

if that helps

Thanks

Adrian

"Eric Klein" <er********@mssm.edu> wrote in message
news:16**************************@posting.google.c om...
If you are using formail.pl, the hidden field is called "redirect".

Eric Klein
<a href="mailto:er********@mssm.edu>er********@mssm.e du</a>
<a

href="http://www.mssm.edu/students/kleine04">http://www.mssm.edu/students/kl eine04</a>


"The Plankmeister" <pl******************@hotmail.com> wrote in message

news:<3f***********************@dread16.news.tele. dk>...
> > I want to write a form that when a user presses submit it carries out
the
> > submit action and then closes the browser or redirects to another

page.
>
> If I understand you correctly, then you want the form processing to
be done
> on the page locally, rather than on the server?
>
> If so... well... It is possible to write a javascript function to

'validate'
> the form and perform pretty much any 'local' operations of the
info... > However, usually for a form to be of any use it needs to send its data to
> the server.
>
> If all you want to do is rewrite the form in a fancy way so that it

looks
> nice, you can do that and still submit the form data to the cgi
script. > However, getting it to redirect to another page after submission is

another
> matter... I'm pretty sure that you cannot change that behaviour, as upon > processing the cgi script, its output is sent to the browser directly. So
> unless you can modify the cgi script, you're stuck. Unless there is

a > parameter you can pass to the cgi script that will redirect it

somewhere.
> Which is doubtful.
>
> HTH.
>
> P.

Jul 20 '05 #10

P: n/a
Find out precisely what script your ISP is using. Yes, it's called "mailform",
but is it "mailform.pl" that's described here: <url:
http://cyberbuzz.gatech.edu/support/cgi_mailform.html />

If so, then you simply need to read the documentation:

Field: REDIRECT

Description:
If you wish to redirect the user to a different URL, rather than having them
see the default response to the fill-out form, you can use this hidden variable
to send them to a pre-made HTML page.

Syntax:
To choose the URL they will end up at:
<input type=hidden name="redirect"
value="http://your.host.com/to/file.html">
To allow them to specify a URL they wish to travel to once the form is
filled out:
<input type=text name="redirect">

Or, if you prefer, the documentation here: <url:
http://www.bci.org/info/using_formmailcgi.htm />

Google is a wonderful thing: <url:
http://www.google.com/search?q=mailform+cgi+redirect />

Adrian wrote:
Hi Eric,
I have tried:
<input type="hidden" name="_1_SuccessDocument"
value="http://uk.altavista.com/">
<input type="hidden" name="_1_SuccessDocument" value="index.htm">

Neither had changed the page displayed! did I enter them correctly? If so I
guess demon have tweaked their script!

Thanks

Adrian

"Eric Klein" <er********@mssm.edu> wrote in message
news:16**************************@posting.google.c om...
for mailform the hidden field should be _1_SuccessDocument
good luck

Eric Klein
er********@mssm.edu
http://www.mssm.edu/students/kleine04
"Adrian" <Ad*************@NOSPAMhotmail.com> wrote in message

news:<bk*******************@news.demon.co.uk>...
Hi,
Thanks but I guess its not formail.pl as redirect didn't work!

The form tag is :
<form action="/cgi-bin/mailform" method="get">

And the ISP is www.demon.net

if that helps

Thanks

Adrian

"Eric Klein" <er********@mssm.edu> wrote in message
news:16**************************@posting.google.c om...
> If you are using formail.pl, the hidden field is called "redirect".
>
> Eric Klein
> <a href="mailto:er********@mssm.edu>er********@mssm.e du</a>
> <a
href="http://www.mssm.edu/students/kleine04">http://www.mssm.edu/students/kl eine04</a>
>
>
> "The Plankmeister" <pl******************@hotmail.com> wrote in message
news:<3f***********************@dread16.news.tele. dk>...
> > > I want to write a form that when a user presses submit it carries out the
> > > submit action and then closes the browser or redirects to another
page.
> >
> > If I understand you correctly, then you want the form processing to be done
> > on the page locally, rather than on the server?
> >
> > If so... well... It is possible to write a javascript function to
'validate'
> > the form and perform pretty much any 'local' operations of the info... > > However, usually for a form to be of any use it needs to send its data to
> > the server.
> >
> > If all you want to do is rewrite the form in a fancy way so that it
looks
> > nice, you can do that and still submit the form data to the cgi script. > > However, getting it to redirect to another page after submission is
another
> > matter... I'm pretty sure that you cannot change that behaviour, as upon > > processing the cgi script, its output is sent to the browser directly. So
> > unless you can modify the cgi script, you're stuck. Unless there is a > > parameter you can pass to the cgi script that will redirect it
somewhere.
> > Which is doubtful.
> >
> > HTH.
> >
> > P.


--
| Grant Wagner <gw*****@agricoreunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #11

This discussion thread is closed

Replies have been disabled for this discussion.