What is JotForm?
JotForm is a free online form builder which helps you create online forms without writing a single line of code. No sign-up required.

At JotForm, we want to make sure that you’re getting the online form builder help that you need. Our friendly customer support team is available 24/7.

We believe that if one user has a question, there could be more users who may have the same question. This is why many of our support forum threads are public and available to be searched and viewed. If you’d like help immediately, feel free to search for a similar question, or submit your question or concern.


  • Profile Image

    How can we access Purchase Order tool total amount value to use it in calculations?

    Asked by bdoodle on February 17, 2015 at 04:22 PM

    Hi,

      I have a purchase order in my form that creates a total of products ordered.  I'd like to access that total and divide it by 2 to calc a deposit required amount.  I would also like that amount and/or the calculated deposit amount to appear in Thank You message and the email generated when the form is submitted.

    Is there ANY way to achieve any of these objectives?

    Thanks.

    Page URL:
    http://www.madsails.com/Order_FS_sailsTest2.html

    total amount purchase order custom calculations
  • Profile Image
    JotForm Support

    Answered by Mike on February 17, 2015 at 06:10 PM

    Thank you for contacting us.

    Unfortunately, the purchase order total value is not currently integrated with the Form Calculation widget. I have attached a ticket to this thread to see if this is something that can be added by our Development Team.

    In the meantime, you might consider either:

    1) Use a source code embedding method with a javascript injection to copy the total value into a text box to use it later in calculations. If you need the javascript code we can help you with this part.

    2) Use the widget based calculations instead of the purchase order tool.

    How to perform calculation in the form
    How to Assign Calculation Value

    It will be possible to include the calculated deposit into Thank You Message and Email Alert if it is calculated on form.

  • Profile Image

    Answered by bdoodle on February 17, 2015 at 06:24 PM

    Hi Mike,

      Thanks for your response. I really don't want to give up the purchase order tool so I'd just consider option 1.  However, I don't know javascript so I'll need your help to create the javascript code to copy the total into a text box elsewhere on the form... the code itself and where to put it.

    I really appreciate your help!

     

  • Profile Image

    Answered by raul on February 17, 2015 at 09:04 PM

    Please take a look at the following link: https://shots.jotform.com/raul/517803/index.html

    I've created a cloned version of your form and used the full source code to implement the script that updates a textbox when the PO total is modified.

    The script that I used to accomplish this is the following:

     <script>
       function CopyText() {
      var POTotal = document.getElementById("payment_total").innerHTML;
      document.getElementById("input_183").value = POTotal;
       }
    </script>

    And to make it work, this function needs to be called when the quantity input box for each item is changed. So you need to search for all the input text that are used for the quantity when you download the source code of your form and add the onChange event listener as below:

    <input type="text" size="3" onblur="if(!this.value)this.value=0" style="text-align:left; width:30px; padding-left:4px " value="0" class="form-textbox form-subproduct-quantity form-subproduct-option" name="q96_flyingScot[special_1025_5][item_1]" id="input_96_quantity_1025_5_1" onChange="CopyText()"/>

    Please check it out and also check the source code of the index.html file so you can see the modifications I did to it and if you have any questions let us know and we'll happy to help.

    Thank you.

  • Profile Image

    Answered by bdoodle on February 18, 2015 at 12:38 AM

    Thank you for doing all this work!

    I take it that I'll always have to update my webpage with the full source code and I'll have to reapply the script above and all the onChange event listeners to the full JotForm source code every time I make ANY change to the form. Right?

    2 other questions to start:

    1. How did the following html get into your form? Did you enter the html code yourself, add a text box in the form editor, or use the Form Calculation widget to create it?

    <li class="form-line" data-type="control_textbox" id="id_183">
      <label class="form-label form-label-right form-label-auto" id="label_183" for="input_183"> Calculation </label>
      <div id="cid_183" class="form-input jf-required">
      <input type="text" class=" form-textbox" data-type="input-textbox" id="input_183" name="q183_calculation" size="20" value="" />
      </div>
      </li>

    I will want to create one more field that is updated every time the Calculation field is updated to contain half the amount there.  The new field would have a label of "Deposit Amount" and be aligned under the Total field.  The Calculation field itself would be hidden because it's a duplicate of the Total.  I'd show both fields in the Thank You message and the email notification. 

    2. Also, how can I get the change in the shipping amount caused by entering the FULLSUIT coupon code to affect the Calculation field's CopyText amount?

    Thanks again for all your help.

  • Profile Image
    JotForm Support

    Answered by Charlie on February 18, 2015 at 10:22 AM

    Hi,

    I take it that I'll always have to update my webpage with the full source code and I'll have to reapply the script above and all the onChange event listeners to the full JotForm source code every time I make ANY change to the form. Right?

    Yes that is correct, when using the form's full source the changes you made in the form builder won't apply directly to the form if you embed the full source, you need to copy the code again and add the custom function you made.

    1. How did the following html get into your form? Did you enter the html code yourself, add a text box in the form editor, or use the Form Calculation widget to create it?

    The HTML quoted by my colleague is one of the input field of your products, in that case it's the input of your "Light Pink Hat With Black Mad Logo" product. But all of the inputs have the onchange="CopyText()" function. If you are adding new fields, it would be better to add it directly using the form builder.

    2. Also, how can I get the change in the shipping amount caused by entering the FULLSUIT coupon code to affect the Calculation field's CopyText amount?

    Not sure if I understand this. The function that my colleague created basically just copies the Payment Total field in your purchase order tool, if there are deducts on the coupon code I believe it should work. Or, if you'll add a coupon code field, you can just search for the input field of the coupon code and add there the function onchange="CopyText();". That should solve it.

     

    I hope this helps. Do let us know if you need more assistance on this.

    Thank you.

  • Profile Image

    Answered by bdoodle on February 18, 2015 at 10:58 AM

    Hello,

      Thanks for your info'.  I need more help with # 1 & 2.  Sorry If I wasn't clear.

    Re #1, the code I included in my prior question was not for the light pink hat, but a new "calculation" field.  Was it created using the Form Calculation widget or???  I ask because I need to create one more new field that will be updated every time the first new "calculation" field is updated.  Its value should be the value of the "Calculation" field divided by two.  Its label should be "Deposit Amount."  I also want to hide the "Calculation" field which is redundant to the Total. 

    Re #2, the function added doesn't copy the Payment Total field, but duplicates the updates to that field to the new CopyText() so the two are in sync.  I cannot find in the source where to put any onChange="CopyText();" for the apply coupon function.  The apply coupon function is not reflected in the test form created by your colleague.  Please...

    make the change in the https://shots.jotform.com/raul/517803/index.html test form to include the coupon function and add code to apply its change to the "Calculation" field so I can find it in the source

    or

    look at my form's source and tell me what to do to have the apply coupon function update CopyText().

    Thanks very much!

  • Profile Image

    Answered by bdoodle on February 18, 2015 at 12:19 PM

    Also, I see that when WI tax is calculated and added to the total, it is NOT applied to the "Calculation" field.  Is there some way to do this? 

    Thanks

  • Profile Image
    JotForm Support

    Answered by Charlie on February 18, 2015 at 12:53 PM

    It seems that you have a lot of requirements on your forms, I would advise to come up with a final form before adding the custom script code to the form's full source code because it would be hard to edit it again. I'll try to come up with a working test form with all the ones you mentioned above, but please do allow us time to do this. 

    Thank you.

  • Profile Image

    Answered by bdoodle on February 18, 2015 at 01:23 PM

    Thank you.  I have finished all changes except for getting access to the total order amount.  Since it reflects the application of a coupon and WI taxes as well as product costs and shipping amounts, I need those numbers reflected in any solution.   I suspect that you will not be able to have the WI taxes, if not the coupon discount, affect the new Calculation field.  So, I'm not doing anything until I hear back on that.  By all means, take the time you need.  I appreciate your efforts.

     

  • Profile Image

    Answered by bdoodle on February 19, 2015 at 08:09 AM

    Wow!  That would be fantastic!  I do not see the payment total values in the calculation wizard however.  Am I doing something wrong?

  • Profile Image
    JotForm Support

    Answered by Charlie on February 19, 2015 at 08:34 AM

    That was fast, I see the changes the developers made but it seems that there's a small glitch, you can try re-adding the Form Calculation widget then look for the short name of the Product field you have.

    In your case, it's the field name "flyingScot", but the problem is that it doesn't stay intact inside the widget when you click save. It disappears but the changes on it applies.

     

    You can see the demo form here: http://form.jotformpro.com/form/50485036823960

    I'll notify again our developers about this so that they can fix the problem.

    Thank you.

  • Profile Image
    JotForm Support

    Answered by Charlie on February 20, 2015 at 08:03 AM

    Hi,

    I just tested the Form Calculation again, and it seems that it is now working as expected, you can now use the Payment Total field for calculations and conditions. 

    Do let us know if you need more assistance on it.

    Thank you.

  • Profile Image

    Answered by bdoodle on February 20, 2015 at 08:45 AM

    Thank you and the developers very much for working on this.  It's REALLY helpful.  A few issues remain:

    1. This is a problem with the coupon processing and is unrelated to the new Calcuation field.  When I complete a form and enter the FULLSUIT coupon, it properly reduces the shipping amount by $30.  If before submitting that form, I hit Clear Form and enter new product orders, the FULLSUIT coupon is applied and reduces the shipping amount automatically! The value, FULLSUIT, does not appear in the coupon field, but it says coupon is valid and reduces the shipping amount per it's rule.  The coupon field is read only.  More strikingly, if you hit Clear Form and just look at the Coupon field, it says coupon is valid and is read only at the outset. i.e. The Clear Form button does not reset the coupon field.

    2. This is a problem with the new Calculation field.  It is not updated when the FULLSUIT coupon is entered.

    3. This is a problem with the new Calculation field. If the state is set to WI (the only one with taxes) at the outset, the Calculation field is properly affected by the taxes for the products ordered.  If the products are ordered before the state is set to WI and THEN the state is set to WI, the taxes are properly reflected in the total, but the Calculation field is not updated. 

    Thanks again for all  your help!

  • Profile Image

    Answered by bdoodle on February 20, 2015 at 08:46 AM

    Perhaps my question #1 above should be moved to a new thread?

  • Profile Image
    JotForm Support

    Answered by Charlie on February 20, 2015 at 10:21 AM

    Hi,

    I've created a separate thread for the first question that you have. You can refer to this one: http://www.jotform.com/answers/519625. We will address to it accordingly.

    Regarding the 3rd concern, so there is a tax for WI of about 5.5%, is that right? I've 

    Here's what I did in my example:

    1. Entered "1" in quantity in the product field. 

    Standard racing mainsail $ 1,015.00 USD

    2. I then Selected state WI

    3. The deposit Due shows $553, is that correct?

    It seems to work as expected? Are you embedding your form in a website? If that is the case, there might be problem on reading the conditions of your form, I would recommend that you embed  your form using the iFrame code to avoid problems on javascript codes. Use this guide to get the iFrame code: http://www.jotform.com/help/148-Getting-the-Form-iFrame-Code 

     

    Do let us know if this works.

    Thank you.

  • Profile Image

    Answered by bdoodle on February 20, 2015 at 10:28 AM

    Thanks for creating the sep thread for my first question.

    Please reread my # 2 and #3 questions. You are not yet understanding the issues.  Yes, your example works, but the conditions described by me do NOT work.

    Thanks.

  • Profile Image
    JotForm Support

    Answered by Charlie on February 20, 2015 at 12:21 PM

    Hi,

    Apologies for the misunderstanding, here is the 3rd concern that you have, the #2 is actually about the coupon code so I have included it on the separate thread. This one is about the state field of WI and its taxes.

    3. This is a problem with the new Calculation field.

    If the state is set to WI (the only one with taxes) at the outset, the Calculation field is properly affected by the taxes for the products ordered.  

    If the products are ordered before the state is set to WI and THEN the state is set to WI, the taxes are properly reflected in the total, but the Calculation field is not updated. 

    I've followed the one highlighted in green, I chose a product before choosing a state then after that I chose the state of WI, calculation in the 50% deposit due shows that amount in the screenshot I presented. But I was also able to replicate the problem you are having. The problem is that the value is being passed to 2 or 3 fields. I would recommend that you directly insert the value to the "Deposit Due" when the province selection is selected. Here's the edited cloned form and see if this process works: http://form.jotformpro.com/form/50504020395949 

    Here regardless of what order of action you create the Deposit due will display the correct value because the trigger of the condition is WHEN THE PROVINCE is FILLED, which is reasonable because it is a required field, I guess. 

     

    I hope this helps. Do let us know if I misunderstood something.

    Thank you.

  • Profile Image

    Answered by bdoodle on February 20, 2015 at 03:22 PM

    Hello,

      The #2 question above refers to a problem filling the new calculation field when a Coupon is entered.  This was not possible before your recent efforts to duplicate the total amount in a new Calculation field.  The problem only involves the derivation of new calculation field value. So, it belongs in this thread, not a new thread about a malfunctioning Clear Form button failing to clear the Coupon field. 

     

    Re #3, did you on your form create a new Calculation field and Deposit Due field?  The Calculation field I have is supposed to have the identical value that is in the total amount field.  The Deposit Due field is supposed to have 50% of that value.  I set up the Calculation field to replicate the total found in the new accessible variable, flyingScot that your developers created.  I set up the Deposit Due field to be the Calculation field / 2.  I then display the Calculation field value as the total amt and the Deposit Due field value as the 50% amt on my Thank you page.  The Calculation field that you have in your test form has a value that doesn't match the total.  Your Deposit Due field appears to be right, but I don't know how because my version of that field is just the Calc field / 2.  

    Please look again.

    Thanks

  • Profile Image

    Answered by Ben on February 20, 2015 at 04:38 PM

    OK, I took a look at this jotform: http://form.jotformpro.com/form/50485036823960 and tried to recreate any issue.

    From what I saw this is the issue:

    1. you select some options and have a value,
    2. apply coupon code
    3. click clear form (at the top)
    4. the values are shown in the payment processing tool at the bottom (under coupon field), but form calculation shows 0
    5. if you click on form calculation it captures the same value that the payment processor has even if all of the fields are empty.

    * the same happens when no coupon code is applied

    Now this does not seem like an issue caused by Form Calculation, but we will check with our developers if we should move this to a new thread to have that issue resolved.

    In regards to the second issue - I am not able to find Deposit Due field so I am not able to see what exactly happens, can you please tell us the link to the latest jotform if not the same as the one above?

  • Profile Image

    Answered by bdoodle on February 20, 2015 at 08:10 PM

    Hi 

    My form is:

    http://www.jotform.com//?formID=50455070789158

    It appears on my webpage:

    http://www.madsails.com/Order_FS_sailsTest2.html

    The Deposit Due field, a calculation field, is to the left of the Submit Form button at bottom of first page.  The other Calculation field is hidden, but it's higher up and more to the right on the form than the Submit Form button. The Calc field is set up with conditional processing to replicate the Total amt on the payment form (flyingScot).  The Deposit Due field is populated via conditional processing to be the Calculation field value divided by 2.

    Issue #2 above is that when a coupon code is entered to reduce the shipping amt and therefore the total, the Calculation field which replicates the total field amt is not reduced. Therefore, the Deposit Due is also overstated.

    The issue #3 above is that WI tax is properly applied to total amt and the Calculation field when the WI state code is entered before products are selected for order, but if one enters the WI state code after the products have been selected on the payment form, the WI taxes are properly derived and added to the total amt, but they do not update the Calculation field.

    I can replicate these issues on my form over and over.

    Please take another look.

  • Profile Image
    JotForm Support

    Answered by Charlie on February 20, 2015 at 10:28 PM

    Hi,

    It seems that we're getting some confusion because there are a lot of different topics being discussed. Regarding the Clear button form not resetting the Coupon code part, my colleague has opened a different thread on it, and I see that you have already replied here: http://www.jotform.com/answers/519625.

    Regarding the 2nd concern that you have, where the Coupon Code not updating the calculation field, it does update BUT ONLY when you navigate away to the Coupon field (example clicking an empty part of the field). Here's the edited cloned form that I have: http://form.jotformpro.com/form/50504020395949.

    The Deposit Due Field in my end works because the calculation is directly done to it and not from another calculation field, then I setup a couple of required fields in the conditions wizard to be used as a trigger for the change to apply:

    Here's an example on the processing of that condition:

    -Payment Total Field -> Calculation Field -> Deposit Due Field

    In my case this is how it is processed:

    IF Province is selected OR First Name is Filled OR Last Name is Filled THEN Directly calculate (Payment Total Field / 2) INSERT it to Deposit Due Field.

    We're setting a lot of trigger fields because I see that you have a lot of fields that are required, so any of those fields could trigger the condition any time. You can clone my form and see how it works. I just left the Calculation field just to see how the changes work and to make some tests. Here's a guide on how to clone it: http://www.jotform.com/help/42-How-to-Clone-an-Existing-Form-from-a-URL 

    Here's my condition block, no need to use the other calculation field, just directly add the payment total field and calculate it.

     

    For the coupon code not triggering a change effect directly on the calculation field, I would like to open up a new thread for it, because originally the topic of this thread is a feature request making the payment total field to be used in calculation, this is for us to better assist you. Please refer to this thread instead: http://www.jotform.com/answers/520074.

    This is quite a long response, I hope it helps and make things more clearer.

    Thank you.

  • Profile Image

    Answered by bdoodle on February 21, 2015 at 02:34 AM

    I can see that you've put a lot of work into your response, but you are perhaps not completely understanding how my form is intended to operate, how it does operate, or the nature of my request for an additional fix.  While I still believe that my issue #2 (raised after the initial fix went in) belongs in this thread, I'll not argue that point and I'll look to the new thread you have set up for it. Thank you.

    Regarding issue #3... This facts are that my hidden field named "Calculation", which is supposed to be have the same value as the total amt field, is not being updated when a state with a tax rate is designated AFTER the products have been ordered.  (It works fine if I put the WI with its associated tax rate in the State field before ordering any products and don't change it later.)  This field is located near the bottom of the first page as shown on the following snippet of the form in design mode.

     

    The Calculation field is updated by a rule in its Calculation Wizard, not the conditions wizard so you can only see the rule on the field itself. See below:

     

    Note that the new flyingScot field created by the developers in response to my original request and which should mirror the total does not appear in the #1 drop down menu above that follows "If", but it does appear in the #2 drop down menu above named Add Field. 

    I need this Calculation field so I can include the order total on my Thank you page.  The total amt itself and the flyingScot fields are not accessible for inclusion on the Thank you page.  

    I also base the Deposit Due calculation field amount on the value in the Calculation field.  It doesn't need to be dependent on more than this one field once it's working properly. A change to the first or last name has nothing to do with the amounts of the order or the deposit due.  Also, the Deposit Due should change only whenever the total amount / flyingScot / Calculation field amounts (which should be in sync) change.  The Deposit Due field is populated via the Conditions wizard. See below:

     

    The remaining problematic behavior of the form is:

    a.) If I enter WI (the state with a 5.5% tax rate) AFTER I enter the order of products,

    the Calculation (and therefore the Deposit Due) fields do not reflect the applied tax amount.

    b.) If I then enter the FULLSUIT coupon code, it does update the Calculation field and therefore, the Deposit Due field. with the tax amount added earlier but not the FULLSUIT coupon discount. (The failure of the coupon code to update the Calculation field sometimes has been moved to the other thread.) 

    c.) If I subsequently enter some other change to my order, like adding a hat, it fixes everything. 

    I just need the updating of the Calculation field fixed to always reflect the latest order total amount including shipping with any COUPON Code applied (to be addressed in other thread) and including the tax amount regardless of what order these amounts are entered or changed via user input.

    I don't know why you reference all the detail level fields to derive Deposit Due when the total is supposed to be in the hidden field named "Calculation" and Deposit Due is just half of that.  The name fields have nothing to do with the monetary amounts. Your logic above would fail to update the field if someone added a hat or changed the type of sail he ordered. 

    Please show my posting here to the developers.  

    Thanks very much!

     

  • Profile Image

    Answered by Sean on February 21, 2015 at 09:36 AM

    Thank you for the clarification provided. I will be checking with my colleagues to see if we can come up with an adequate solution to get this issue resolved. I will respond once we have a proper solution. Your patience is appreciated.


    Thank you.

  • Profile Image

    Answered by bdoodle on February 22, 2015 at 01:47 PM

    Hi,

    I'm including a snippet of the email generated when I submitted my form just now.  If you look at the "Calculation" field, you can see that it has an amount greater than the actual total amount by more than the $30 shipping reduction that usually fails to update it and that is an open issue in another thread.  In this case, I did not use the WI state code to generate any 5.5% tax amount.  So, why is the Calculation field (built off flyingScot, supposedly a mirror of the total amt) overstated by $135?  

    We know that the $30 coupon sometimes fails to update the Calculation field. If that were the only error that happened this time, the Calculation field would have been $3444 and the difference between it and the actual total would have been $105. Previously in this thread, I have only reported problems with the 5.5% WI tax amt and the $30 coupon code amt improperly updating the flyingScot and Calculation fields. Now, it appears that some other errors are occurring in updating the flyingScot field.  I though those of you working on this problem should see this additional evidence.

     

  • Profile Image

    Answered by Sean on February 22, 2015 at 02:53 PM

    Thank you for the additional information provided. We will ensure that it is also looked into when addressing all the other issues mentioned earlier. Sorry for the delay with our response but as I stated earlier, once we have a proper resolution to your inquiry you will be notified immediately. We will be in touch.


    Cheers!