# Calculation summary based on a number of selections from the form

• Coruze
Asked on December 03, 2014 at 06:58 PM

I am creating a form that requires calculations based on choices that the user selects.

The first option is the user needs to select their Country. (Australia, USA, New Zealand and Other)

The second option is that the user needs to select how many tags they would like each month. ( The option for 1 tag is not included as there is a two (2) tag minimum)

The third option is that the use selects how many months they would like their subscription to run for. ( The option for 1 month is not included as there is a two (2) month minimum)

The details are as follows:

Australia  - 2 tags cost \$6.50

- 3 tags cost \$8.70                      Payments are in AUD

- 4 tags cost \$10.50

- 5 tags cost \$11.90

USA - 2 tags cost \$7.15

- 3 tags cost \$9.35                            Payments are in US

- 4 tags cost \$11.15

- 5 tags cost \$12.55

New Zealand - 2 tags cost \$7.50

- 3 tags cost \$9.70               Payments in US

- 4 tags cost \$11.50

- 5 tags cost \$12.90

OTHER - 2 tags cost \$8.40

- 3 tags cost \$10.60                    Payments in US

- 4 tags cost \$12.40

- 5 tags cost \$13.80

I want the calculation summary to show the quantity of tags selected, quantity of months selected and the total cost based on their selection.

I would appreciate any help I can get with this please

• Welvin
Answered on December 03, 2014 at 10:15 PM

Hi,

This is possible, and you can achieve it by following this guide: https://www.jotform.com/help/268-How-to-Insert-Text-or-Mathematical-Caculation-into-a-field-using-a-Condition.

So if you're going to multiply the quantity and the number of months, your conditional logic would be like this:

Just repeat it until each all selections matches to each other. For example: http://www.jotformpro.com/form/43368915968978

Selections are: Australia - 2 Path Tags - 2 months.

Let us know if you need any further assistance.

Thanks

• Coruze
Answered on December 04, 2014 at 04:32 AM

Thank you very much for your prompt response, it's greatly appreciated!

I'll get to work :)

• Welvin
Answered on December 04, 2014 at 06:10 AM

You are welcome! Let us know if you have any questions.

Thank you!

• Coruze
Answered on December 06, 2014 at 01:43 AM

Hi again,

With reference to the screen shot above, can you please tell me how I can put \$0.00 as the default. I have tried adding it to the default in properties but it doesn't show at all.

• abajan
Answered on December 06, 2014 at 08:55 AM

Normally, it would just be a matter of clicking the field and entering \$0.00 in the Default Value box:

However, if a calculation condition is attached to a field this will not work. The "\$0.00" will briefly flash on the screen as the jotform is loading and then vanish. Thankfully, there's a workaround: Create a condition to display the default value. In your form's case the condition would be as follows:

Now, if "\$0.00" is going to be shown by default in the Total Price box, it wouldn't look right if when selections are made in the other Subscription Details fields, numbers not in the currency format were to appear there. That can be corrected by inserting a \$ before the calculation and selecting Show empty decimal places:

Of course, you would need to do that for all of the form's 177 conditions!

Lastly, to your original query, I notice that my colleague's clone of your jotform has a summary section with the text "You have chosen ? pathtags for ? months which is a total of \$??". My assumption is that your form originally had that section, with the intention being that after a user makes the following choices (for example)

Where are you located: Australia
How many tags each month: 2
How many months: 3

the text would read: "You have chosen 2 pathtags for 3 months which is a total of \$19.50." Unfortunately, to my knowledge, there's no way to accomplish this in the form builder. The closest you can come to that would be to use our Preview Before Submit widget but it has no setting to customize the output into a paragraph. So, your only alternative would be to embed the form's full source into a web page of your own (which is to say, a web page outside of JotForm's domain) and add a script there to populate the text with the user selections. Later, I can provide a demo of what I mean.

Cheers

• abajan
Answered on December 06, 2014 at 09:47 PM

@Coruze

Here's the demo I promised you. The page break isn't absolutely necessary but the script (which you'll see near the bottom of the page source) works better when listening to the click on the "Next" button than to events on other elements. If you select "Australia", "2 pathtags" and "4 months", you will see a currency formatted result in both the Total Price field and the text on the second page will be populated accordingly. Note also that the Total Price has been changed to read-only, preventing users from editing it. (Although, in this case that doesn't appear to be critical.)

Is this the sort of functionality you wanted?

P.S. I didn't complete the currency formatting of all of the conditions because the form is just meant to be a demo of what's possible.

Thanks

• Coruze
Answered on December 09, 2014 at 04:28 AM

Thank you very much again for your help.

This is simply superb!

I have changed all conditions to show empty decimal places and I am really happy now.

I am kind of lost in regards to the currency format. This would definitely compliment my form and I would like to do this as well.

The only two currencies I use is AUD and USD

Can you please explain it further.

Also after that is done I'm pretty sure my form is complete. However I don't know how to incorporate this one. If I add the page via the source code that's okay but are you able to tell me how I would get the end result to a shopping cart?? I just use PayPal. This form will calculate a price and the user will click submit then i'm completely lost.

Any help or suggestions would be great!

• Welvin
Answered on December 09, 2014 at 07:44 AM

I am kind of lost in regards to the currency format. This would definitely compliment my form and I would like to do this as well.

-You just need to add the sign to the conditional logic and as per my colleague instructions. Then you would need to check the "Show empty decimal places" option from the advance settings.

However I don't know how to incorporate this one.

-Abajan can give you the script to accomplish the summary.

If I add the page via the source code that's okay but are you able to tell me how I would get the end result to a shopping cart??

-You can pass the calculation result to the Paypal Integration. This guide would help you how to do it: http://www.jotform.com/help/275-How-to-pass-a-calculation-to-a-payment-field

-Following the given method, the user will be redirected to Paypal Payment page right after they click the submit button.

Let me also forward this thread to my colleague Abajan. I know he can help us accomplish these things to your form ;)

Thanks

• abajan
Answered on December 09, 2014 at 01:58 PM

Hi again Coruze,

It actually may not be necessary to embed the jotform's source code anywhere but the solution I have in mind will require a total of three (3) jotforms. The main one which will be very similar to that we've been working on, and two payment forms, one for each currency. On submission of the main form, depending on if the currency is AUD or USD, the user will be redirected to the appropriate payment form. I'll work on something later which will demonstrate the functionality to which I'm referring.

Thanks

• Coruze
Answered on December 09, 2014 at 03:47 PM

Thanks for your response Welvin but my first question was about putting AUD and USD behind the total price, maybe I didn't communicate this properly.

Thankyou abajan. Thats what I am looking for :) I don't mind doing 3 forms just as long as I can get it to paypal somehow.

I appreciate everyone's help immensely...thank you....thank you.....thank you

• abajan
Answered on December 10, 2014 at 11:26 AM

Hi again,

Please test this other demo and let us know if its functioning as desired. If Australia is selected in the "Where are you located" field, the jotform redirects to a second form which, when submitted, redirects to the AUD version of the PayPal payment page:

Conversely, if any other location is chosen in the same field, the user will be redirected to a form which looks like an exact replica of that which Australia residents see but when submitted redirects to the USD PayPal payment page:

Regarding your question about how to get AUD or USD displayed after the amount is the Total Price box, in each condition just insert it after the calculation:

Unfortunately, unlike what I earlier thought, it looks like you will need to use the full source code for the two jotforms that redirect to PayPal.

Anyway, just let us know if the setup in the demo would work for you. If it does, we'll tell you how to configure it.

Thanks

• Coruze
Answered on December 10, 2014 at 11:42 PM

Hi Abajan

I have tested the demo and that is exactly what I'm looking for!

Thank you for your dedicated time you have spent helping me :)

I look forward to hearing from you in regards to how I set this up

• abajan
Answered on December 11, 2014 at 01:09 PM

Hi Coruze,

1. Clone this jotform (see this cloning guide)

2. Remove the following code from its injected CSS:

#id_77 {
display: none;
}

3. Click Close Settings and then scroll all the way down to the bottom of the form where you'll see the PayPal field

4. Right-click that field and and then click Show Properties

5. Enter your PayPal email, select No for Authorization Only and disable Sandbox Mode

6. Close the Properties

7. Copy to your clipboard the code in step 2, return to the injected CSS and paste the code back in. (As you may have guessed, this code hides the PayPal field.)

8. Click Close Settings and save the jotform

9. Copy the full source of the form (as explained here) to your clipboard

10. Create a web page on your website and paste the jotform code into the body of the page's source

11. Copy this code to your clipboard and paste it between the jotform code and the closing body tag of the web page's source

12. Save the web page

13. Clone this jotform and repeat steps 2 to 12

14. Copy to a text file the URL of each of the web pages created above and note which URL contains which jotform

15. From the text file, copy to your clipboard the URL of the webpage containing the code of your clone of the USD Payments jotform

16. Clone this third jotform, go into its Conditions Wizard and click Saved Conditions

17. Search the list of conditions for the one which states: IF Where are you located Is Not Equal To "Australia" Redirect to ...

It might not be the first condition as shown in the screenshot but it should be there somewhere in the list.

18. When you find it, click it and then in the Then redirect to box click the very beginning of the URL (before the "h" as shown below)

19. Press the Delete key and remove everything before the question mark, taking care not to delete the question mark

20. Hit [Ctrl+V] to paste the URL from your clipboard into position before the question mark

21. Save the condition

22. Make the currency formatting changes to all the conditions which need them, as we earlier discussed in this thread (this could take some time) and close the wizard when done

23. From the text file, copy to your clipboard the URL of the webpage containing the code of your clone of the AUD Payments jotform

24. In the toolbar at the top of the form builder, click the Thank You button and then click Next

25. Click the beginning of the URL and repeat the procedure provided in steps 18 and 19, the only difference being that it will be the URL of the webpage containing the AUD Payments jotform instead of the other one

26. Click Finish and save the jotform

That's about it! Please keep us informed of your progress and if you need clarification on anything above, do let us know.

Thanks

• Coruze
Answered on December 12, 2014 at 06:48 AM

Thanks Abajan

I cloned as per instructions however in No.2 of the instructions it says to remove the code from it's injected CSS.

It's not there to remove it???

Do I just continue on??

I will wait before doing anything else in case this is a critical step

Hope to hear from you

• Welvin
Answered on December 12, 2014 at 09:49 AM

It's actually there:

This is your clone http://www.jotform.co/form/43452468376867, right? We can remove it for you. Let us know if you need help with it.

Thanks

• Coruze
Answered on December 15, 2014 at 08:58 PM

Hi there,

I have been following the instructions given (above) and I have come to the third form that I needed to clone to continue on.

No 17.

IF Where are you located Is Not Equal To "Australia" Redirect to ...

I don't have the information that you are referring to.

So now I am lost.

So sorry to be a pain but I need help again please

Thanks!

• raul
Answered on December 16, 2014 at 12:40 AM

I assume you're referring to the step 17 on abajan's guide. Is that correct?

If so, what you need to set there is the URL of the form that will handle the USD payments which I assume is this one: http://www.jotform.co/form/43487370359868. If this is correct, then you need to replace the https://www.jotform.com/thankyou.html with the following URL:

The condition should look like this:

You need to do the same for the custom URL of the Thank you page configured in the form. In this case I assume that this form: http://www.jotform.co/form/43487170597870 will be handling payments in AUD. If this is correct, then the URL should be the following:

Hope this helps.

Let us know if you need further assistance.
Thank you.

• Coruze
Answered on December 16, 2014 at 01:39 AM

Hi Raul,

The form I was referring to is : http://www.jotformpro.com/form/43424900058955

I noticed the form you mentioned didn't have the same number.

Does that mean the form you were referring to is different to the one I posted here??

• abajan
Answered on December 16, 2014 at 04:18 AM

Hi Coruze,

Due to the number of jotforms involved, the automatic ID change when a jotform is cloned and the fact that the URL of the web pages within which two of the jotforms must be embedded will not resemble the forms' own URLs, this stuff can get really confusing really fast!

Okay, first of all, the form mentioned in your last reply (http://www.jotformpro.com/form/43424900058955) is actually mine. Your clone of it is http://www.jotform.co/form/43488033948869. Now, it appears that when a form is cloned, the redirect URLs in its conditions revert to the default because as you have rightly stated, the relevant condition in your clone has just https://www.jotform.com/thankyou.html

To correct that, please do the following:

1. Copy all of this code to your computer clipboard

2. Load your "Clone of 2nd Demo ..." jotform in the form builder, go into its conditions and click the same one pictured above

3. Remove the default URL from the "Redirect to" box and paste the code copied in step 1

4. Go to step 18 of my previous reply and continue

If you encounter any other issues, please let us know.

Cheers

• Coruze
Answered on December 28, 2014 at 12:24 AM

Hi there,

I thought I had completed everything I needed to and followed the instructions correctly but every now and then my form doesn't work.

Sometimes the amount doesn't show up and flow through the pages correctly.

I received 2 submissions and the value was \$0 and 1 submission that showed \$39 but no money came through. I tried doing it myself and the amount came through as \$0 as well.

On the review form the top information box says Review your details and if something is wrong to use the back arrow on the browser but when you click that it removes all information and you have to start again.

I am really not sure how I fix this, so I am hoping someone can help me PLEASE

• ashwin_d
Answered on December 28, 2014 at 06:29 AM

Hello Coruze,

I'm sorry for the trouble caused to you.

I am not sure about your requirement but I I did test your form "#43487170597870"and it seems to work as expected and the total amount does display correctly in your submission. Please check the screenshot below:

All the other submissions you have received in your form does display the total amount correctly.

Can you please explain the issue you are having for more clarity?

We will wait for your response.

Thank you!

• ashwin_d
Answered on December 28, 2014 at 06:46 AM

Hello Coruze,

Upon taking a closer look at your form, it seems I was able to understand your issue. It seems the PayPal payment question of your form displays the amount as "0" correct?

I did test your form which you have embedded in your web page and it seem the amount of the paypal payment question is reset to zero after the submit button is clicked. Please check the screenshot below:

This is the reason why your form is not redirected to PayPal checkout page to process the payment. It seems the issue is caused because you have embedded your form using it full source code. I will do further tests to figure our ways to solve this problem. For now, I would suggest you to embed your form using its script embed code and that should solve your problem.

Thank you!

• Coruze
Answered on January 08, 2015 at 12:58 AM

Hi Ashwin,

Thank you, I have embedded the form correctly and I think it's working fine now.

• Coruze
Answered on January 17, 2015 at 10:05 PM

Oh dear,

I thought this was working all fine when I embedded the code correctly on my website but it still doesn't work when it comes to payment and keeps referring back to 0.00.

Any chance you could help me fix this please??

Coruze

Answered on January 17, 2015 at 11:58 PM

Hi Coruze,

I do apologize for the issue that you are experiencing with your form.

Can you provide us with the URL where your form is embedded so that we can take a closer look?

To confirm, was the issue resolved and then reverted to the PayPal amount going to zero or was there no change when you embedded using the script code?

Thank you.

• Coruze
Answered on January 18, 2015 at 07:34 AM

The issue wasn't resolved at all.

The error was originally thought it was occurring because I didn't embed it correctly and that is why the problem was happening.

But even with it embedded correctly the form keeps reverting back to zero??

I'm lost, so I hope you can help me :)

• Ben
Answered on January 18, 2015 at 08:44 AM

Hi Coruze,

I am looking at this, but as there are many steps that are mentioned, I will leave a comment to my colleagues to follow up on this, as they are more familiar with all that was done and what I think that would work instead.

The reason I will do this is not to cause further confusion and more replies to go through, which I hope that you will understand.

One of my colleagues will get back to you shortly.

Best Regards,
Ben

• abajan
Answered on January 18, 2015 at 08:12 PM

Hi again Coruze,

Sorry to hear that this isn't working out as expected. I think we'd better make a fresh start and abandon the full source route altogether. The new procedure will be much less complicated but before I provide any instructions, test this jotform and let us know your thoughts. Using the workaround in this guide, it's actually five (5) jotforms in one.

Basically, all you will need to do is clone all five forms, edit four URLs in the main one, edit the conditions in the other four and change some settings in the payment fields of the same four. The changes to the payment fields are the same ones mentioned earlier in this thread. Your biggest job is going to be editing the conditions but it will be easier with this new system than with the previous one because (as you'll see when they're cloned) each form will have conditions relevant to just one region. Anyway, we'll get into the details later. For now, just test drive the form as much as you wish and we'll see how best we can tweak it to suit your needs. There's one issue I encountered, related to the summary, for which I hope there's a solution. You'll see what I mean when you run the tests.

We look forward to hearing from you.

Thanks

• abajan
Answered on January 19, 2015 at 07:10 AM

Hi again,

The issue related to the summary has been corrected. (The summary and submit button were appearing at the top of the form, out of sight of the user.)

Thanks

• Coruze
Answered on January 21, 2015 at 01:25 AM

Hi Abajan,

Sorry, but I am a little confused here in regards to your coment "The issue related to the summary has been corrected"

Do I start again by cloning the forms??

How can this be corrected if I haven't done anything? Do you have access to my account and fixed the issue yourself??

I look forward to hearing from you :)

• ashwin_d
Answered on January 21, 2015 at 03:09 AM

Hello Coruze,

If I am not wrong, it seems my colleague @abajan corrected the issue in one of his demo form: http://form.jotformpro.com/form/50175210935954

I would suggest you to test this form and see if it works as expected.

Thank you!

• Coruze
Answered on January 22, 2015 at 05:49 AM

Hi and thank you.

I have tested this without looking to much into the prices/formats etc and it seems to work fine and it definitely directed me to PayPal :)

So I gather I clone the forms that abajan posted on the 18th. Is there anything else I should do or need to know pls beside checking the format

Regards Coruze

• Welvin
Answered on January 22, 2015 at 07:45 AM

Yes, I think you have a few steps to follow. Will get back to you later today for the full steps.

Thanks

• abajan
Answered on January 22, 2015 at 11:34 AM

Hi Coruze,

Glad to hear everything looks good so far. Okay, here's what you need to do to complete this:

2. Delete the said jotforms, both from your account and from any web pages in which they were embedded. (Should you see a message asking if you wish to keep the products for another payment gateway, click No)

3.
Clone all five (5) of my new jotforms in the following order:

4. After cloning the last one, right-click the My Forms tab at the top of the form builder and when the shortcut menu pops up, click Open link in new tab:

5. You should now see all the newly cloned jotforms listed on the My Forms page. In that new tab, load the form named Clone of (Australia) 469068 ... into the form builder and then repeat the procedure for each form yet to be loaded

6. At this point you should have five (5) browser tabs open, each with one of the cloned forms, with the leftmost tab containing the Clone of (Main Form) 469068 ... form. Go to the tab containing the Australia form, click the Preview button and copy the URL to your computer clipboard and paste it into a blank text file and put a note next to it indicating that that's the URL for the Australia form

7. Repeat step 6 for all the remaining jotforms except the main one, so that you have the URLs to four (4) forms listed in the text file, each with a note indicating the form page to which it points. (Hereinafter I'll refer to those four jotforms collectively as the "country" forms)

8. Copy the Australia form's URL from the text file to your clipboard

9. Go to the main form's tab and scroll down until you see the top of a blank grey rectangle. This is the first of four Iframe Embed widgets in this form. Launch its wizard by clicking the button indicated below:

10. Replace the URL there with what's on your clipboard and close the wizard:

11. Copy the URL of the New Zealand form from the text file and then scroll down until you come to the second Iframe Embed widget and repeat step 10

12. Do likewise with the United States and Other forms in that order

13. Save the form and then go to its URL to check and make sure that the correct form loads for each selection made in the Where are you located field. (You will need to refresh [reload] the form each time to get back to the said field)

14. Please refer to steps 2 to 8 in my 5th reply to this thread (made on December 12, 2014 Australia time). Follow those instructions for each of the country forms but in step 2 you'll no longer find the following rule in any of the forms' injected CSS

#id_77 {
display: none;
}

Instead, you'll see the rule highlighted below:

Remove it from each of the country forms, so that you can make the necessary changes to their PayPal integration, then replace the rule to hide the field again.

15. At this point everything except for the conditions in the country forms should be configured correctly. As stated in my last reply, this will be your biggest task. Below is an example of what needs to be done.

Go into the conditions of the Australia form and you'll see that each condition starts with the rule: "If Where you are located Is Equal To Australia":

Now, if you think about it, in this form the selection will always be Australia! So, there's no need for that rule. As such, it should be removed from each condition. Click each condition having that rule and delete it:

Now, I should state here that doing the above isn't absolutely necessary. And if you find it too tedious to do that for all 44 such conditions in each country form, leave it out but if you do do it, you'll find that the conditions will look less cluttered if you need to edit the amounts to be displayed in the Total Price field.

There's something else that needs to be dealt with in each condition. Note the format of the calculation, with the "\$" preceding the calculation and the "AUD" after. Besides checking to see that the amounts are correct, ensure that all of the conditions have that format.

Now, there's one condition in each of the country forms that's different to the the type shown above:

In this condition, you will need to remove the first rule because the Where are you located field will never be empty. Unlike the previous one ("If Where you are located Is Equal To Australia"), this is not optional. However, there should only be four such rules which need deleting: one in each of the country forms.

That's pretty much it. If anything is unclear, please let us know.

Thanks

• Coruze
Answered on January 23, 2015 at 01:21 AM

Hi there,

I completed steps 1 and 2 however now I am getting an error when I try to clone the 5 forms in step.3 Here is the error I get:

Hmm I'm starting to get a little discouraged which is not to be taken as an offence because the amount of help you have all put in is greatly appreciated to the say the least.

Is this a simple fix or a bigger issue now that I have deleted the forms??

Hope to hear from you

Corinne

• abajan
Answered on January 23, 2015 at 05:16 AM

Hi Corinne,

Try cloning the forms from the following alternative URLs:

http://www.jotformpro.com/form/50175070245952

http://www.jotformpro.com/form/50175597947975

http://www.jotformpro.com/form/50175275820958

http://www.jotformpro.com/form/50175529452961

http://www.jotformpro.com/form/50175210935954

There may be a CDN (Content Delivery Network) issue associated with the other URLs. (Forms at http://form ... are served via a CDN while those at http://www ... are not.)

A Content What??

• Coruze
Answered on February 16, 2015 at 06:18 PM

Hi there,

I have completed all the required step as per instructions - THANK YOU

Is there any way I can change the format of the total price output to include t

two places after the decimal point?

So instead of having \$24.2 I would like it to show \$24.20

and instead of \$38 I would like it to show \$38.00

How do I put the form onto my website - Is it just copy the source code for the main form only or do I have to put all forms in like I had to do previously?

Again thank you for everyone's time and effort you have all invested in this, it is greatly appreciated!

Corinne

Answered on February 16, 2015 at 08:13 PM

Hi Corinne,

On behalf of my colleagues, you are most welcome. We are happy to know that you have been able to get your form working as desired.

As your two questions are different from the title of the thread, I have moved them to new thread: