homepage Welcome to WebmasterWorld Guest from 54.198.33.96
register, free tools, login, search, pro membership, help, library, announcements, recent posts, open posts,
Become a Pro Member

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
Forum Library, Charter, Moderator: open

JavaScript and AJAX Forum

    
Different posting action on mutiple submit buttons
I want my customers to have the choice of paypal
Kenton




msg:1486318
 10:37 am on Oct 14, 2005 (gmt 0)

Hi

I currently have:
<form name="MyForm" action="http://formmail.example.com/cgi-bin/formmail.cgi" method="POST">
...
<input type="button" value="Submit" onclick="if(CheckInput(this.form))this.form.submit()">

and what I'd like to do is give my customers another button (as well) that if they select it, it goes to paypal instead.

Paypal requires a different "action" cgi.

I hope this makes sense

Thanks
Kenton

 

RonPK




msg:1486319
 11:16 am on Oct 14, 2005 (gmt 0)

If someone hits the enter button, your form will be submitted without passing through checkInput(). I suggest using
<form ... onsubmit="return checkInput(this);">.

Anyway, you could add a button that alters the form's action and than submits it:


<input
type="button"
value="Pay, Pal"
onclick="this.form.action='paypal-url here'; this.form.submit();"
>

Kenton




msg:1486320
 11:30 am on Oct 14, 2005 (gmt 0)

If someone hits the enter button, your form will be submitted without passing through checkInput().

So THATS what's happening Now I understand.

I'll give your code a go Thanks!

Bernard Marx




msg:1486321
 11:52 am on Oct 14, 2005 (gmt 0)

Use a proper, type="submit", for the default submit button
- else your JS-disabled benefactors won't be able to add to your piggy bank.

Kenton




msg:1486322
 12:05 am on Oct 17, 2005 (gmt 0)

Thanks Guys.

I've found out what my issue is. I'm trying to submit a form twice, once to PP, once to me.

As far as I can gather, I can't get this to work because of forms resetting, not getting confirmation back from PP etc.

So, what I have decided to do is this:
Post the purchase form to me as normal (with the fixes you have suggested) and then, on the "Thank you for your purchase" page, give the option to pay by PP.

Now, my question is (being a newbie to JS) how do I pass variables from the original form (say ClientName and TotalPrice) to the form on the redirect page?

Simple question, I'm sure, but I'm not coping with any of this very well.

Thanks
Kenton

Global Options:
 top home search open messages active posts  
 

Home / Forums Index / Code, Content, and Presentation / JavaScript and AJAX
rss feed

All trademarks and copyrights held by respective owners. Member comments are owned by the poster.
Home ¦ Free Tools ¦ Terms of Service ¦ Privacy Policy ¦ Report Problem ¦ About ¦ Library ¦ Newsletter
WebmasterWorld is a Developer Shed Community owned by Jim Boykin.
© Webmaster World 1996-2014 all rights reserved