473,786 Members | 2,765 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

How to submit a form to multiple web sites?

How can I submit a form to multiple web sites when user click the
submit button? Something like the following:

myform.action = url_of_server1;
myform.submit() ;
myform.action = url_of_server2;
myform.submit() ;

The above code only submit form to url_of_server1. The second submit is
ignored. Is there any trick to make it works? For example is it
possible to use XMLHttpRequest object to submit the form
asynchronously?

Dec 20 '05 #1
5 4342
@sh
As far as I'm aware - a client side form post can only submit to a single
form, the result of that form could then post again, but you cannot post two
simultaneously.

Another way to do this would perhaps be using frames with the two frames in
their own frame...or an even better idea is to use IFrames for each form?

I'm sure the experts here will confirm or amend what I've said ;o)

Cheers!

<ni**********@l exisnexis.com> wrote in message
news:11******** **************@ g44g2000cwa.goo glegroups.com.. .
How can I submit a form to multiple web sites when user click the
submit button? Something like the following:

myform.action = url_of_server1;
myform.submit() ;
myform.action = url_of_server2;
myform.submit() ;

The above code only submit form to url_of_server1. The second submit is
ignored. Is there any trick to make it works? For example is it
possible to use XMLHttpRequest object to submit the form
asynchronously?

Dec 20 '05 #2
It looks like what you're trying to do that has a better server side
solution.

It might be possible to get two submits.

Oh ... it's ugly.

I can think of it only because I've seen code where forms were getting
submitted twice unintentially.

Experiment with this...

<html>
<head>
<script>
function doSubmit() {
myform.action=" url_of_server1" ;
myform.submit() ;
}
</script>
</head>
<body>
<form name="myform" action="url_of_ server2" onsubmit="doSub mit();">
<input type="submit" value="Submit" name="Submit">
</form
</body>
</html>

Dec 20 '05 #3
ni**********@le xisnexis.com wrote:
How can I submit a form to multiple web sites when user click the
submit button? Something like the following:

myform.action = url_of_server1;
myform.submit() ;
myform.action = url_of_server2;
myform.submit() ;


If you put an IFRAME into your page:
<IFRAME name=myframe1 src="about:blan k"></IFRAME>

and then insert myform.target = "myframe1" before the first
myform.submit() , the response will be directed to the embedded iframe.
Subsequently to that submit, you'd better change back the
myform.target. I could imagine that there might be an issue since the
second submit will wipe out the target of the first submit, but that
shouldn't affect what happens server side. Experimental results will
be appreciated.

Csaba Gabor from Vienna

Dec 21 '05 #4
On 2005-12-20, ni**********@le xisnexis.com <ni**********@l exisnexis.com> wrote:
How can I submit a form to multiple web sites when user click the
submit button? Something like the following:

myform.action = url_of_server1;
myform.submit() ;
myform.action = url_of_server2;
myform.submit() ;

The above code only submit form to url_of_server1. The second submit is
ignored. Is there any trick to make it works? For example is it
possible to use XMLHttpRequest object to submit the form
asynchronously?


after the first submit succeds the page is cleared and the javascript stops
executing.

one way would be foe the CGI at server1 to use libcurl (etc) to submit the
data to server2

another would be to clone the form in a popup and submit one to each server

a third would be to use xmlhttprequest etc.....

what sort of result are you looking for?

Bye.
Jasen
Dec 21 '05 #5
Your suggestion works great. Here is my sample code:

<script language="JavaS cript">
function submitForm(thef orm) {
theform.action = "http://www.google.com/";
theform.target= "myframe1";
theform.submit( );

theform.target= "";
theform.action = "http://www.yahoo.com/";
theform.submit( );

}
</script>

<html>
<body>
<form action="" onSubmit="submi tForm(this); return false;">
<input type="text" name="userName" value="" />
<input type="Submit" />
</form>
<IFRAME name="myframe1" src="about:blan k" width="0"
height="0"></IFRAME>
</body>
</html>

When you click the submit button, the form is POST to both Google and
Yahoo (I verified this by Network sniffer). In the end, you only get
the result page from the second submit (the Yahoo result page). This is
fine. I don't care the result page from the first submit.

Thanks for the help.

Dec 21 '05 #6

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
6049
by: Mark Michel | last post by:
Hi. I have made an html form which I would like to send by e-mail. When the recipient receives the e-mail form, I would like them to be able to fill it out and click the Submit button which will submit to an ASP page. This ASP page contains the code to submit the form data to a database. The page works fine when viewed through a browser, but the form will not submit in Outlook 2002 (I haven't tried other mail programs). Any...
2
2359
by: Phillip Windell | last post by:
This is really an HTML question I think, but it probably won't take much effort to answer (unless I'm answering or course). The HTML is all ASP generated and the ASP generates exactly what I want but the resulting HTML isn't working right. It consists of multiple forms on a page with each form using a unique name. The submit button in each form also uses a unique name. The forms are supposed to submit a single value from a hidden field...
4
5811
by: Slug | last post by:
Hello, I've tried to find this answer, but can't seem to get a clear example - I'm using the following classic asp code to submit a form: <form action="default.asp" name=order method=post> What I need to do is to submit the form to multiple .asp pages, (that I want to join with frames) and I can't find a way to do it. Thanks.
3
10152
by: Adam | last post by:
Hey guys, I've decided to stop banging my head against the wall and just ask you guys for the answer. I can't seem to find it. I have a form in which I have multiple submit buttons; only, I'm using button tags, not input tags to do it. It seems that IE6 is treating all the button elements as being successful on submit. This is, to say the least, surprising since the Spec is pretty clear that it should.
6
13396
by: tencip | last post by:
Hi everyone, So, i've got a form that is very simple. It hold three elements: username, password, and domain. The goal here is to have the form submit the login to an administrative section depending on which domain someone has chosen. For instance, let's say we have three administrative sites, that all have different URLs, but we want this one form to handle logging into any of them. So, the form itself needs to have a dynamic action
8
5080
by: Gert | last post by:
Hi, I have a form (server side) because of the filling of variables through the application. But now I need to post it to an url on submit. My .HTML form looks like this, but how to translate it to asp.net vb code? !--<FORM ACTION="/test/test.php" METHOD=POST>--> <form action="https://multipay.net/transaction/mpmain.php" method="post"> ....
23
3232
by: mosesdinakaran | last post by:
Hi All, I need a small clarification in submitting the forms, Ur suggestions please. In a page I have two form and also two submit butons. (ie)
8
12102
by: Willie | last post by:
Hi All; I have a form with multiple buttons and I would like to disable the buttons after the user clicks on the button to prevent multiple submitions. <input type="submit" name="return1" value="Send To MFG" id="return1" onClick='this.disabled=true;this.form.submit()' > This works but I do not get the return1 value passed to the action script as I do if I just have :
0
9496
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10363
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8989
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6745
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5397
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5534
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4066
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3669
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2894
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.