homepage Welcome to WebmasterWorld Guest from 54.237.213.31
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / HTML
Forum Library, Charter, Moderators: incrediBILL

HTML Forum

    
How to do a form redirect?
Form redirect
beautykat

10+ Year Member



 
Msg#: 11695 posted 5:36 am on Feb 1, 2006 (gmt 0)

I have the following form redirect,

<form method=post onSubmit="window.open ('index.htm')" action="http://us.1.p.webhosting.yahoo.com/forms?login=__">

<input type="submit" value="Submit Comments"></form>

When submitting the form, how do I get it to redirect to my index page without opening up another window? Right now, it is opening a new window and the other window shows all the information entered into the form.

Thanks for helping.

 

Dijkgraaf

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 11695 posted 6:58 am on Feb 1, 2006 (gmt 0)

What are you trying to achieve?
The form has to submit to somewhere.

You could remove the
onSubmit="window.open ('index.htm')"
Then it won't open up the second window, however it also won't go to your index page, but rather to the page in the action.

For it to go to your index.htm after submitting, then the target page that you are submitting to has to do the redirect.

beautykat

10+ Year Member



 
Msg#: 11695 posted 5:33 pm on Feb 1, 2006 (gmt 0)

I am trying to get the customer to go to a Thank You page when the customer submits the form. Right now, all it does is go to a page listing all the selections picked.

Dijkgraaf

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 11695 posted 7:20 pm on Feb 1, 2006 (gmt 0)

So can you edit the page to which the form is submitting?

beautykat

10+ Year Member



 
Msg#: 11695 posted 3:17 am on Feb 2, 2006 (gmt 0)

No, the page I am submitting to does not allow me to make changes. The form works by sending me an email with the information via yahoo.

If there isn't a way around this, can this function be accomplished with javascript?

Dijkgraaf

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 11695 posted 4:03 am on Feb 2, 2006 (gmt 0)

No, not easily and certainly not with JavaScript. If you could do it with JavaScript then you would have a massive cross domain scripting vunerability.

beautykat

10+ Year Member



 
Msg#: 11695 posted 5:43 pm on Feb 2, 2006 (gmt 0)

Then, is there anyway to accomplish what I want without going through the yahoo domain?

Dijkgraaf

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 11695 posted 7:13 pm on Feb 2, 2006 (gmt 0)

Where is your form hosted? If on Yahoo, then possibly no, you are limited to what Yahoo offers as services.
On most other web hosting services you could write a form that would do the e-mailing and have a thank you as well.

jollygoodfella

5+ Year Member



 
Msg#: 11695 posted 7:30 pm on Feb 2, 2006 (gmt 0)

Sounds like you need to add a HIDDEN FIELD so it redirects your user to a thank you page you have created. Try this code below your <form>:

<input type="hidden" name="redirect" value="http://your.host/to/file.html">

Dijkgraaf

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 11695 posted 7:42 pm on Feb 2, 2006 (gmt 0)

Or possibly the other one I came accross is this
<input type="hidden" name="next_url" value="URL">
and it was talking about the Geocities/Yahoo mail form.
[wise-old-man.com...]

beautykat

10+ Year Member



 
Msg#: 11695 posted 11:59 pm on Feb 2, 2006 (gmt 0)

Thanks for all the help. Is this how I do it? Then, how do I get the submit button to display?

<form method=post action="http://us.1.p.webhosting.yahoo.com/forms?login=__">

<input type="hidden" name="redirect" value="http://your.host/to/file.html">

</form>

jollygoodfella

5+ Year Member



 
Msg#: 11695 posted 7:09 pm on Feb 3, 2006 (gmt 0)

You would need to add a button like this:

<input type="submit" name="Submit" value="Submit">

That would go above your "</form>" code. Maybe you should think about going through some form tutorials there are plenty of them online or pick up an html book :)

beautykat

10+ Year Member



 
Msg#: 11695 posted 3:45 am on Feb 4, 2006 (gmt 0)

jollygoodfella,

Thanks for posting. Actually, what I am struggling is how to implement a form submit with a redirect. I was told that the following will do a redirect, then the question is how do I do this with a submit button.

<input type="hidden" name="redirect" value="http://your.host/to/file.html">

</form>

Dijkgraaf

WebmasterWorld Senior Member 5+ Year Member



 
Msg#: 11695 posted 8:13 am on Feb 5, 2006 (gmt 0)

Just as jollygoodfella said, the button doesn't differ, you are just adding a hidden field to the form, that the receiving page has to process.

jollygoodfella

5+ Year Member



 
Msg#: 11695 posted 12:22 am on Feb 7, 2006 (gmt 0)

The use of hidden fields basically tell the form different things without the user seeing them. So you would still setup your form with its name, action, etc... then add your input fields and a submit button. The HIDDEN fields can go anywhere between "<form" and "</form>". I usually place mine right below the opening "<form>" statement. There are all kinds of hidden fields you can use, some are: redirect, required (which marks certain input fields required), subject, etc...

What kind of information are you trying to collect exactly? If you don't have a working form already I would suggest looking at [scriptarchive.com...] as it goes into pretty good detail about getting a form setup.

I could also lend a hand for a small fee of course if you are having a tough time. But keep reading and playing around with it...that's going to be your best bet in the long run and you'll figure it out:)

beautykat

10+ Year Member



 
Msg#: 11695 posted 6:07 am on Feb 7, 2006 (gmt 0)

Thanks for all the help... looks like I can do both a hidden field and submit field in a form. I will try and see if this will work for me.

Basically, what I have right now is a form where I collect some survey information from customers as they sign up as memebers. But I would love to be able to redirect to a thank you page and offer an immediate coupon code when they submit the form. Right now, it only shows the information entered when the form is submitted.

ONce again, thanks!

jollygoodfella

5+ Year Member



 
Msg#: 11695 posted 10:55 pm on Feb 8, 2006 (gmt 0)

just add that hidden field, create that thank you page and you should be golden.

mehh

5+ Year Member



 
Msg#: 11695 posted 4:34 pm on Feb 12, 2006 (gmt 0)

try

<form method=post onSubmit="window.location='index.htm' action="http://us.1.p.webhosting.yahoo.com/forms?login=__">

<input type="submit" name="submit" value="submit">

</form>
it works and you dont have to change the page that will recive the form

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / HTML
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved