Become a MacRumors Supporter for $50/year with no ads, ability to filter front page stories, and private forums.

black_genes

macrumors newbie
Original poster
I have succesfully used a javascript to submit a form and go to a new location by clicking a link. But the script does not work in Safari 1.2 anymore.The script will only submit now.

Here's the script:
<form name="test" method="post" action="submit.html" >
<input name="name" type="text">
<a href="java_script_:document.test.submit(); document.location='new_location.html';">Submit & go</a>
<input type="submit" name="Submit" value="Submit">
</form>

The two javascript commands will work seperatly. I've tried the "onclick"-approach instead, does not work neither. I've also tried making a function instead. No luck.

My scripting language of choise is PHP and I don't use much JS, so maybe I'm missing something, but hours of googling haven't revealed any solution.

Any suggestions?
 
I can't see how that would work in the first place. You are trying to submit the form to one page and redirect to another with the same window?

A better option is to put a redirect on your submit page (submit.html), so once it's done doing its thing, the user is redirected to new_location.html.
 
Thanks for your reply, kingjr3.

The script does work for Netscape 6, Safari 1.1 and IE6Win. It does not work for IE5Mac. Redirecting from the submit page is not an option, as the whole point is to have two different locations, the regular submit page and an alternative page, where you can make a choise and then return to the form. If I would not submit the form, the previously typed information would be lost.

Anyway, I found out that the following script does work for Safari 1.2:
<form name="test" method="post" action="submit.html" >
<input name="name" type="text">
<a href="new_location.html" onclick="document.test.submit();">Submit & go</a>
<input type="submit" name="Submit" value="Submit">
</form>
This still does not work for IE5Mac.

The 'javascript:' in a href is depreciated. That may be why it does not work for Safari 1.2 anymore.
 
Register on MacRumors! This sidebar will go away, and you'll see fewer ads.