0

Hi all,

I've been trying to solve this problem for like 3 hours, but couldn't solve it, so any help would be appreciated.


I want to perform 2 actions on 1 form and on 1 submit.
address1 - i only have to send datas
address2 - i have to send datas AND go to that address.

Here's the form:

<form method="post" action="??">

.......

<input type="submit" ...>
</form>

I've tried something like this, but didn't work:

little trick:

function actions(f){
f.action='address1';
f.target='action1';
f.submit();
f.action='address2';
f.target='_self';
f.submit();
}

part of that trick:

<iframe name="action1" width="1" height="1" frameborder="0" scrolling="no"></iframe>

and the form:

<form method="post">
....
<input type="button" onclick="actions(this.form)">

logically, this trick should work, but it throws me to the 405 not allowed page.


bro`s, help me out please.

3
Contributors
4
Replies
5
Views
7 Years
Discussion Span
Last Post by Hangfire
0

i think,

In html form, 2 action is not possible

Hi all,

I've been trying to solve this problem for like 3 hours, but couldn't solve it, so any help would be appreciated.


I want to perform 2 actions on 1 form and on 1 submit.
address1 - i only have to send datas
address2 - i have to send datas AND go to that address.

Here's the form:

<form method="post" action="??">

.......

<input type="submit" ...>
</form>

I've tried something like this, but didn't work:

little trick:

function actions(f){
f.action='address1';
f.target='action1';
f.submit();
f.action='address2';
f.target='_self';
f.submit();
}

part of that trick:

<iframe name="action1" width="1" height="1" frameborder="0" scrolling="no"></iframe>

and the form:

<form method="post">
....
<input type="button" onclick="actions(this.form)">

logically, this trick should work, but it throws me to the 405 not allowed page.


bro`s, help me out please.

0

You need to learn ajax.
Instead of the submit button, submitting the form via the action the submit button calls a function. That function can have an ajax call in it to do the job of submitting the form, but that same function could do a host of other things, including another ajax call.

http://www.w3schools.com/ajax/default.asp

This taught me ajax, have a go and post back if you're still stuck

This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.