[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Submitting 2 forms at once



I feel you need to have the first form trigger the second form.  You will
never know how long it takes for the first form to be sumbitted., because
the Web isn't always as fast as we'd like!  And there are no "submission
successful" flags sent -- you have to do that.

What you can do is have the CGI response of the first form send back a page
that includes JavaScript that sends the second form.  Obviously, you need
something like frames or multiple windows to do this, so yoo don't overwrite
your first form.  Or, you can use a cookie to temporarily save the second
form contents, then read the cookie on the second pass.  Or...just use one
form! <g>

-- Gordon

At 12:23 PM 3/6/96 -0100, you wrote:
>Hello!
>
>Maybe someone can helo me:
>
>I try to send two forms at the same time, then change the location.
>
>This is done by copying the content of the first form into the second, 
>then both forms shall be submitted -they have different ACTION.
>
>After submission, the Visitor should be directed to another page.
>I tried:
>______________________  SNIPPLE _______________________________
>
>var timeout = 3000;
>
>var timeout2 = 10000;
>
>var NewLocation = "respond.html";
>
>function SendTwo()
>
>{
>        Obj = document._form.emailSenderName;
>        Obj2 = document.form2.emailSenderName;
>        Obj2.value = Obj.value;
>        Obj = document._form.emailSenderAddress;
>        Obj2 = document.form2.emailSenderAddress;
>        Obj2.value = Obj.value;
>        Obj = document._form.emailBody;
>        Obj2 = document.form2.emailBody;
>        Obj2.value = Obj.value;
>        TID1 = window.setTimeout("document.form2.submit();",timeout);
>        TID2 = window.setTimeout("GoToResp();",timeout2);
>        return true;
>}
>function GoToResp()
>{
>                var ref = window.location.href;
>                var last = ref.lastIndexOf("/");
>                ref = ref.substring(0,last);
>                ref += "/" + NewLocation;
>                window.location.href = ref;
>}
>
>
>______________________ SNAPPLE ___________________________
>
>and it worked on my machine (with the files on my harddisk) - 
>but when it was uploaded to thi Internet, it does not work always
>
>Any idea? Any idea to do that without those stupid timeouts?
>It does'nt send both forms if I don't use it.....
>

--------------------------------------------------------------------
For help about the list, please send a message to 'majordomo@obscure.org'
with the message body 'help'. To unsubscribe, send a message to
'majordomo@obscure.org' with the message body 'unsubscribe javascript'.
List archives and pointer to FAQ: http://www.obscure.org/javascript/