Welcome to WebmasterWorld Guest from 54.197.171.28

Forum Moderators: open

Message Too Old, No Replies

Different posting action on mutiple submit buttons

I want my customers to have the choice of paypal

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

10+ Year Member



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

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

WebmasterWorld Senior Member 10+ Year Member



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();"
>
11:30 am on Oct 14, 2005 (gmt 0)

10+ Year Member



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!

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

WebmasterWorld Senior Member 10+ Year Member



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.
12:05 am on Oct 17, 2005 (gmt 0)

10+ Year Member



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