How to Pass a Form’s Calculated Value to Another Form’s Payment Total Field

March 15, 2022

In case you’re not aware, you can pass a calculated value to a payment field’s total box. It’s discussed in the How to Pass a Calculation to a Payment Field guide. However, what if you want to pass the calculated value from one form to another form that has a payment integration? In this tutorial, you’ll learn how to pass a calculated value to the second form, particularly on the PayPal payment gateway for donations or custom payments. Basically, this is a basic prepopulating method using URL parameters, which is similar to the How to Automatically Pass Form Data to Another Form guide.

To start, you must have 2 different forms. Form 1 does the calculation and Form 2 is where the payment field will be populated.

NOTE: You can only pass a calculated value to a payment field if its Payment Type is set to either Collect Donations or User Defined Amount.

form-builder-payment-type-user-defined-min.png

Example:

To pass the calculated value to the PayPal field on the second form, follow these steps.

Build the Thank You Page URL

Create the “Thank You” page URL using the second form’s URL since Form 2 will serve as the thank you page of Form 1.

So, whenever the user submits the first form, they will be redirected to the second form with the payment field prepopulated.

We’ll use the following constructed Thank You Page URL as an example:

https://www.jotform.com/213473516582054?myProducts[price]={calculation}

To break that down:

  • https://www.jotform.com/213473516582054 – the URL of Form 2.
  • ? – the question mark is used as a separator.
  • myProducts[price]={calculation} – the query parameter in keyvalue pair.
    • myProducts[price] – the tag or unique name of the PayPal payment element on Form 2 as the key.
    • {calculation} – the variable tag of the calculation field in Form 1 as the value.

Here’s how to get the tags or unique names of the fields to create a key-value pair.

Form 2: Payment Element’s Unique Name

  1. Edit Form 2 and click the Payment element’s gear icon.
  2. Go to the Advanced tab.
  3. Expand the Field Details section.
  4. Copy the Unique Name field’s value.
form-builder-myproducts-unique-name-min.png
  1. Append [price] to it. In this case, the result is myProducts[price].

Form 1: Form Calculation Widget’s Unique Name

Edit Form 1 in the Form Builder and get the unique field name of the field where the calculated value will come from.

  1. Click your Form Calculation widget’s gear icon to open its Properties panel.
  2. Go to the Advanced tab.
  3. Expand the Field Details section.
  4. Copy the Unique Name field’s value.
form-builder-calculation-unique-name-min.png
  1. Enclose it with curly brackets to use it as a variable. In this case, the result is {calculation}.

Form 1: Thank You Page

Set the constructed URL as Form 1‘s custom “Thank You” Page URL.

form-builder-redirect-to-an-external-link-after-submission-min.png
  1. Go to the Form Builder’s Settings tab.
  2. Then Thank You Page on the left.
  3. Choose the Redirect to an external link after submission option.
  4. Paste the completed URL with parameters to fill out the second form (https://www.jotform.com/213473520367959?myProducts[price]={calculation})

Your changes will automatically be saved and you’re done. Go test your form!

Demo (submit this form to see how it works): https://www.jotform.com/213473520367959

Was this guide helpful?
Contact Support:

Our customer support team is available 24/7 and our average response time is between one to two hours.
Our team can be contacted via:

Support Forum: https://www.jotform.com/answers/

Contact Jotform Support: https://www.jotform.com/contact/

Send Comment:

Jotform Avatar
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Comment:

Podo CommentBe the first to comment.