RA

ok, basically what I want to do is this:

<form method="POST" action="https://www.google.com/asdf.cgi" action="http://www.asdf.com/blah.pl" > I have had trouble finding a proper method to do this so that it actually submits to both actions on submit. please help.
add a comment
0

7 Replies

  • Votes
  • Oldest
  • Latest
LI

I'm not sure that would work; it'd only do one of them. What exactly is it that do you want to do?

add a comment
0
RA

I want to have one submit button perform multiple actions. Just like above, only that HTML wont work, and I'm not really good in java to where I can assign functions to perform the multiple actions.

add a comment
0
RB

I didn't have time to test this extensively, but this is what I came up with off the top of my head, and it worked when I tried to submit it to two different formmail scripts.

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
<head>
<title>Untitled</title>
<script type="text/javascript">
<!--
function doubleSubmit(f) 
{
    // submit to action in form
    f.submit();

    // set second action and submit
    f.target="_blank";
    f.action="formmail2.php";
    f.submit();
    return false;
}
//-->
</script>
</head>
<body>
<form method="post" action="formmail.php" onsubmit="doubleSubmit(this)">
<input type="text" name="myTextBox"><br>
<textarea name="myTextArea"></textarea>
<input type="submit" value="Double Submit">
</body>
</html>
add a comment
0
RA

this looks great and all, but isnt it just submitting to one formmail? what i'm trying to do is have the form submit to two separate mailing lists. so when someone puts their email into the text box and clicks submit, they subscribe to my list and a neighbor sites list.

i would think it would involve having two functions in the onsubmit(); but i dont know how to write it. where function 1 would be the action= method= and function 2 would be the same. i think something like onsubmit('function1();','function2();'); just a hunch. this is what i need help with

add a comment
0
RB

No, it was submitting to formmail.php and formmail2.php, but there's a bug that I didn't see earlier. Internet Explorer keeps submitting to the second one twice. I'll try to look at it some more tomorrow.

add a comment
0
CA

I don't have time to write out the code, but the way I would probably hand this is by, instead of using a form submit button, I would use a regular button with an onClick that populates some global JS variables with your form data, then opens two small popups. Those popups contain a form with only hidden fields that get populated by an onLoad function from the opener variables and then submits with the last action being a window.close();

When the person clicks submit, these two windows popup then close (best to put window.blur() on both, or window.focus() on the form window). Then, use a while loop (careful to avoid infinite loops...) to watch those two windows, and once both are closed, location.href to a thank you page.

There is no way to do what you are talking about in pure HTML.

The other way is to chain your Perl scripts, so that, at the end of doing whatever the first one does, it forms an HTTP request and sends it to the second one... I've had a bit of success with doing this, though I was sending XML streams via HTTP from a Perl script to an ASP script (heh, don't ask... I one found myself writing a Perl script, to create ASP code that printed out JavaScript code that manipulated HTML... makes you're head hurt just to think about it... escaping quote marks was a bloody nightmare!)

.c

add a comment
0
NI

Many thanks for the tip. I needed to do exactly this as I wanted to have a submit button send an email using my ISP's standard email CGI script. I then needed all the same data to be sent to my credit card processing company.

I achieved it using your advice which was invaluable - thank you.

add a comment
0