|
|
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?
|
|
0
|
|
|
|
Reply
|
ningjun.wang (11)
|
12/20/2005 2:06:34 PM |
|
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!
<ningjun.wang@lexisnexis.com> wrote in message
news:1135087594.651903.142250@g44g2000cwa.googlegroups.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?
>
|
|
0
|
|
|
|
Reply
|
sh
|
12/20/2005 2:33:55 PM
|
|
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="doSubmit();">
<input type="submit" value="Submit" name="Submit">
</form
</body>
</html>
|
|
0
|
|
|
|
Reply
|
gimme_this_gimme_tha
|
12/20/2005 11:32:42 PM
|
|
ningjun.wang@lexisnexis.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:blank"></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
|
|
0
|
|
|
|
Reply
|
Csaba
|
12/21/2005 1:31:42 AM
|
|
On 2005-12-20, ningjun.wang@lexisnexis.com <ningjun.wang@lexisnexis.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
|
|
0
|
|
|
|
Reply
|
Jasen
|
12/21/2005 5:33:00 AM
|
|
Your suggestion works great. Here is my sample code:
<script language="JavaScript">
function submitForm(theform) {
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="submitForm(this); return false;">
<input type="text" name="userName" value="" />
<input type="Submit" />
</form>
<IFRAME name="myframe1" src="about:blank" 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.
|
|
0
|
|
|
|
Reply
|
ningjun
|
12/21/2005 4:14:00 PM
|
|
|
5 Replies
92 Views
(page loaded in 0.129 seconds)
Similiar Articles: PDF Form submit with both HTML and FDF responses. - comp.text.pdf ...The pdf forms that I have to work with have the form submit button action set to ... not* send blank fields if you wish for > a user to be able to fill a form in multiple ... Multiple actions through a single form action - comp.lang.php ...PDF Form submit with both HTML and FDF responses. - comp.text.pdf ... One approach is ... Your visitor fills in one ... protocol and the one-URL form action ... Multiple Form ... How to make PDF form posted on some website editable? - comp.text ...Hi, I am making a website and want to put some PDF forms on the site. My intention is to ... You may also wish to add some action buttons to your form, e.g., submit, reset ... Can javascript do something at submit() time to dstract the user ...Can javascript do something at submit() time to distract the user?... like clear the form... ... I have seen some fancy ways to prevent multiple clicks ... Open multiple files (on network) with one click? - comp.databases ...How Do You Merge Multiple Word Files Into One PDF? ... forms data ... Files With A Single Click - MultiFire But if you want to open multiple files, applications, or websites ... Help Multiple Layouts - comp.databases.filemakerI created a form that has a tabbed view. So every tab is changing to a duplicate ... have the functionality to host multiple layouts within the same map document. Multiple ... populating multiple checkbox choices in script - comp.databases ...PDF Form submit with both HTML and FDF responses. - comp.text.pdf ... I have a ... just populate the form with ... wish for > a user to be able to fill a form in multiple ... Create Multiple Windows at Runtime - comp.graphics.api.opengl ...HI all I am trying to create multiple windows at runtime. I am ... Dev Center > Windows Forms Forums > Windows Forms General > How do you create multiple combobox's at ... single threaded vs. multi threaded - comp.unix.solarisIf you do that, then we can submit answers directly ... It is always of the form: month-year@domain. Hitting ... threaded vs. multi threaded - comp.unix.solaris Multiple ... Using JavaScript to read form fields in a PDF file - comp.text.pdf ...submit form, validate form, set cookie, send email, download file ..... of the fields ... Fields with JavaScript, " for additional information. ● Processing multiple PDF ... How to submit a form to multiple web sites? - JavaScript / Ajax ...How to submit a form to multiple web sites?. JavaScript / Ajax / DHTML Forums on Bytes. The HTML Form Submit Button - Javascript-Coder.com — Javascript ...The basics of an HTML form submit button is discussed first in this article, moving towards more advanced topics like multiple submit buttons. Note: If you are ... 7/4/2012 8:33:05 AM
|
|
|
|
|
|
|
|
|