Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.javascript > #18754
| Newsgroups | comp.lang.javascript |
|---|---|
| Subject | Re: How to submit a form with two actions? |
| From | "Evertjan." <exxjxw.hannivoort@inter.nl.net> |
| References | <d7794c16-2790-4efb-b512-fba93780e624@googlegroups.com> |
| Date | 2013-03-07 23:52 +0100 |
| Message-ID | <XnsA17CF2D07AD8Feejj99@194.109.133.133> (permalink) |
justaguy wrote on 07 mrt 2013 in comp.lang.javascript:
>
> Is it possible? If so, the following script does not work, what's
> wrong? Thanks.
>
> <script type="text/javascript">
>
> function doubleSubmit(f)
> {
> // submit to action in form
> f.submit();
> // return false;
>
> // set second action and submit
> // f.target="_blank";
> f.action="action2.html";
> f.submit();
> // return false;
> }
>
> </script>
>
> <form name="checkout" method="post" action="action1.html"
> onsubmit="doubleSubmit(this)">
> <input type="text" name="customer">
> <input type="hidden" name="dev" value="test">
> <input type="submit" name="send" value="Place Order">
> </form>
If you submit without specifying a target,
your page will be overwritten,
and there can be no second submit.
Don't forget the return in onsubmit,
ortherwise you get 3 submits,
methinks.
<script type="text/javascript">
function doubleSubmit(f) {
f.method = 'post';
f.target = 'anotherPage';
f.action = 'action1.html';
f.submit();
f.method = 'get'; // ! ;-)
f.action = 'action2.html';
f.submit();
return false;
};
</script>
<form onsubmit = 'return doubleSubmit(this)'>
...........
--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
Back to comp.lang.javascript | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 13:18 -0800
Re: How to submit a form with two actions? Danny <dann90038@gmail.com> - 2013-03-07 14:40 -0800
Re: How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 14:46 -0800
Re: How to submit a form with two actions? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-03-07 15:31 -0800
Re: How to submit a form with two actions? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-08 00:42 +0100
Re: How to submit a form with two actions? Daniel Pitts <newsgroup.nospam@virtualinfinity.net> - 2013-03-07 15:55 -0800
Re: How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 16:43 -0800
Re: How to submit a form with two actions? Stefan Weiss <krewecherl@gmail.com> - 2013-03-08 02:55 +0100
Re: How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 18:09 -0800
Re: How to submit a form with two actions? Stefan Weiss <krewecherl@gmail.com> - 2013-03-08 04:21 +0100
Re: How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 19:37 -0800
Re: How to submit a form with two actions? Stefan Weiss <krewecherl@gmail.com> - 2013-03-08 13:18 +0100
Re: How to submit a form with two actions? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-08 20:51 +0100
Re: How to submit a form with two actions? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-07 23:52 +0100
Re: How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 15:16 -0800
Re: How to submit a form with two actions? Danny <dann90038@gmail.com> - 2013-03-07 15:22 -0800
Re: How to submit a form with two actions? "Evertjan." <exxjxw.hannivoort@inter.nl.net> - 2013-03-08 00:37 +0100
Re: How to submit a form with two actions? justaguy <lichunshen84@gmail.com> - 2013-03-07 16:44 -0800
Re: How to submit a form with two actions? Denis McMahon <denismfmcmahon@gmail.com> - 2013-03-09 05:09 +0000
Re: How to submit a form with two actions? Thomas 'PointedEars' Lahn <PointedEars@web.de> - 2013-03-08 20:50 +0100
csiph-web