Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Two functions for the same submit button

Status
Not open for further replies.

etu1972

Programmer
Jul 29, 2002
69
US
I want one submit button to do two things: 1) send Paypal shopping cart info to Paypal; and 2) send form info via email. Can one button do both these things? If so, is there an example of this dual function button somewhere that I could look at? Thanks, AMc

Should I stay or should I go? Thanks & Goodbye, Joe.
 
Add onclick="sendCard(); anyFun1(); anyFun2();..."
into <input type=&quot;submit&quot;>.

OR

Change
<FORM action=&quot;YourURL&quot; onsubmit=&quot;sendCard(); anyFun1(); anyFun2();...&quot;>
 
You might have some trouble with that, due to the fact that both of those actions would require a different page to load (I think).

I am not so sure about the ebay shopping cart thing, but I would imagine that would need a new page to load.

What you can do is to have the page for the ebay shopping cart load into a different window (
Code:
window.open...
) and then the form email open in the same window that your form is in....if that all makes sense. Multi window jobs are hard to explain. LOL




&quot;Why is it always the quiet ones?&quot;

Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
AIM & MSN: robacarp
 
vadim i dont think he is talkng about calling two functions here, he is talking about sbmitting the form at the same time to two different pages. one to the paypal page, other to the email sending page. am i correct joe?

Known is handfull, Unknown is worldfull
 
am i late as usual...

but eclipse i think that can be done with iframes(i seem to be obsessed with them)...

Known is handfull, Unknown is worldfull
 
I would agree, two different submits with one form.

You could do that with iframes....but I have never been a big fan. Remember that anything that you can do with an Iframe, you can also do with another window

here is what I would do:

open up another window with the same form in it, but all the fields are hidden. Then populate the value's of this page from the original form, and submit the new form. Then, close the window and submit the original form (to the other source).

You could make this almost unseen to the user...however, you might have trouble with popup blockers.

Also, if you did it like this:
Code:
newWindow = window.open(...&quot;newWindow&quot;...);
window.focus();
populateForm(&quot;newWindow&quot;);
newWindow.someForm.submit();
newWindow.close();

the user probably wouldn't even notice the script in action.....


&quot;Why is it always the quiet ones?&quot;

Robert Carpenter
questions? comments? thanks? email me!
linkemapx@hotmail.com
AIM & MSN: robacarp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top