Calculation text fields with total to Paypal

  • Profile Image
    AwakeningConference
    Asked 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.

     

    http://form.jotform.co/form/33104455951855

    http://pastie.org/8463546

  • Profile Image
    Mike_T
    Answered 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:

    <script src="//ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    For local testing you can try:

    <script src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.2/jquery.min.js"></script>

    I am not much a JS expert, but I will try to check/debug code later today, and then get back to you.

  • Profile Image
    AwakeningConference
    Answered on November 07, 2013 at 04:28 PM

    That would be great, thank you so much!

  • Profile Image
    AwakeningConference
    Answered 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

  • Profile Image
    Mike_T
    Answered 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.

    http://pastebin.com/VPW3bXxb

    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).