PDA

View Full Version : Javascript Form actions assistance please


Buzz
April 16th, 2001, 01:50 AM
i'm having a bit of a problem.

I'm trying to mail a form then redirect the page in javascript.

I can get the form to mail easily enough with a mailto: form action, and I can get the redirect to work with a submit function. the problem I have is I can't get both to work at the same time.

Now I know i could use a cgi script for this but I really want to try and get it working with just javascript/dhtml.

I've also tried a graphic submitbutton that calls the function to submit then redirect.

i.e.:

function doSubmit () {
document.forms[0].submit()
location = "page.html"
}


I can't get that working either.

Any help would be appreciated. Thanks

Steven.Bentley
April 16th, 2001, 12:25 PM
it's location.href="url"

or location.replace("url") if you don't want the page doing the redirect to show up in the history :)

Buzz
April 16th, 2001, 06:59 PM
Thanks Stven. Everything I have says location = "url". Damn reference book! I hate it when they're wrong!

I'll give the location.href a whirl and let you know if that works.

Thanks again.

Buzz
April 23rd, 2001, 04:27 PM
Aaaarguh. Still no luck. Okay I'm breaking out the cgi script. I know that works.

Thanks for the help anyway Steven.

Steven.Bentley
April 23rd, 2001, 06:58 PM
Strange... at least one of the JS methods will normally work, usually both of them :confused:

Buzz
April 23rd, 2001, 07:26 PM
Yeah, that's what I thought.

Maybe I should just retype the darn code. Even though I know it's all in there correctly, you know that sometimes simply retyping it does something to make it work. Lord knows what.