- AwakeningConferenceAsked on November 07, 2013 at 02:48 PM
Hi, I'm trying to create a script that can add together user inputted text fields (numbers) and calculate the total and display it in a text box then when the form is submitted go to Paypal with that number. I've included my form and the code I've come up with so far. I don't think I've written the script correctly. It is my first attempt at trying to teach myself! Could you help me come up with a solution for this? Thanks so much.
- JotForm SupportMike_TAnswered on November 07, 2013 at 03:28 PM
Thank you for contacting us.
As far as I understand, you are trying to do the calculations with jQuery, so you will also need to include the library:
For local testing you can try:
I am not much a JS expert, but I will try to check/debug code later today, and then get back to you.
- AwakeningConferenceAnswered on November 07, 2013 at 04:28 PM
That would be great, thank you so much!
- AwakeningConferenceAnswered on November 07, 2013 at 05:44 PM
I feel like my code should be working because I replicated a similar code from another Jotform. But I can't seem to figure out the problem. If I could get that working then all that would be left is finding out if it's possible to send that number to be paid for in Paypal.
This is the form I had the script from that I saw in another thread https://shots.jotform.com/elton/jotform_calculate_225033.html
- JotForm SupportMike_TAnswered on November 07, 2013 at 06:51 PM
You are welcome.
There is a link to the corrected script, I have only corrected IDs and removed unused fields.
You can add the script after the form closing tag </form>. Also, you do not need to include the jQuery library, the script is based on Prototype JS instead (and that library is already included to the form).