Solved

Submit Two Forms with One Submit Button

Posted on 2013-01-30
5
333 Views
Last Modified: 2016-03-24
This is another question that I have researched repeatedly over the years and have yet to find a workable answer. Given how web pages process information these days, it has to be a very common issue.

I have a membership application form. Four things need to be done with the information: it is written to a log file, it is emailed to both the applicant and to the secretary, it is updated in a database and it is passed to Paypal for payment. The first three tasks are accomplished by submitting the form to a VBScript page. Next, a separate form is submitted to Paypal:
 
        {
        document.paypalForm.submit();
        document.emailForm.submit();
        }

I've read repeatedly that two submits with one button won't work, but it works perfectly in IE. It doesn't work in most of the other browsers. There has to be a way to accomplish this. Hopefully, someone out there who has solved this problem and will share it.
0
Comment
Question by:sherleon
  • 4
5 Comments
 
LVL 11

Expert Comment

by:Andrew Angell
ID: 38836661
You can add just add the PayPal stuff to the bottom of your VBscript so that you don't have to show a separate form.

What I would recommend is using Express Checkout.  This works over API calls and opens you up to more freedom to build your checkout system the way you want.  

You can add a simple CURL request to pass PayPal all of the order data to start the checkout, and they will pass back a token.  You simply add this token to the end of a redirect URL to PayPal, so when the VBscript is done running the next thing the user would see is the PayPal login (or guest checkout) option.

Once the user is done at PayPal it will send them back to whatever ReturnURL you specify in your SetExpressCheckout request.  

You could also do the same thing a little bit more simply by just building a URL for the payment.  You can use any of the PayPal Standard Variables within a URL to create a payment and simply redirect the user to that URL.

For example, here's a "buy me a beer" URL I've used a lot over the years.

https://www.paypal.com/xclick/business=paypalemail@domain.com&item_name=1%20Beer&currency_code=USD&amount=5.00&shipping=0.00&handling=0.00&tax=0.00

Open in new window


You'll see if you load that URL it'll take you into a payment using those parameters, and again, you can include as many parameters as you want from that standard variable list.  

I personally prefer Express Checkout, but whatever you think is best for your project would work fine.
0
 

Author Comment

by:sherleon
ID: 38839594
I'd thought to do it this way but wasn't sure how to handle the Paypal submit. I'm not familiar with a CURL request but will do some research. I'll give it a try today. It would so make my life simpler.
0
 

Author Comment

by:sherleon
ID: 38841039
OK, I'm going to have to take this a step at a time. All of the data for the database, log file, emails and Paypal are assembled in the main entry form. With my latest updates, I'm passing everything needed for db, log and emails to the VBScript page. I assume I should now include the Paypal data. I have several entry forms, so the number of fields for Paypal varies considerably (I have a separate VBScript for each form). I then assemble a CURL request with the Paypal values passed to hand off to Paypal?
0
 

Accepted Solution

by:
sherleon earned 0 total points
ID: 38841870
I verified that the VBScript page is receiving all the Paypal variables. I've been researching all afternoon how to do the submit and am stumped. Can you help me to get started on where to go from here.
0
 

Author Closing Comment

by:sherleon
ID: 38946870
I didn't mean to accept this as an answer. After the initial response it was ignored for nearly a month. I asked for help and never got it. I found the answer myself. I'm not renewing my subscription.
0

Featured Post

Threat Intelligence Starter Resources

Integrating threat intelligence can be challenging, and not all companies are ready. These resources can help you build awareness and prepare for defense.

Join & Write a Comment

Introduction This article is the last of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article covers our test design approach and then goes through a simple test case example, how …
Several part series to implement Internet Explorer 11 Enterprise Mode
This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.
This Micro Tutorial will demonstrate how to add subdomains to your content reports. This can be very importing in having a site with multiple subdomains.

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now