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 I update the form calculation widget with the API?

    Asked by lengtche on March 03, 2015 at 08:04 AM

    We're using the form calculation widget and it works great once all set up. Our problem is that we have so many products that it becomes quite the error prone chore to ensure we properly created our totals formula before sending off the calculated number to PayPal for processing. I know how to use use the API to update common form properties, but updating the calculation equation isn't actually going through.

    I can see the following JSON being returned when I issue a GET for my form properties - 

     "calculations": [ { "decimalPlaces": "1", "equation": "[{3}{4}]", "ignoreHiddenFields": "", "insertAsText": "", "newCalculationType": "1", "operands": "3,4", "readOnly": "", "resultField": "6", "showBeforeInput": "", "showEmptyDecimals": "" } ]

    Now say I want to update the decimal places of my calculations, I would issue a PUT to /forms/{id}/properties with the following data - 

    {"properties":{"calculations": [{"decimalPlaces": "4"}]}}

    This returns - 

    { "responseCode": 200, "message": "success", "content": { "calculations": [ { "decimalPlaces": "4" } ], "formID": "50607523092248" }, "limit-left": 9987, "duration": "26ms" }

    However, the decimal places never actually changed.

    How can I achieve this?

    Thank you.

     

    form calculation API update properties
  • Profile Image

    Answered by Ben on March 03, 2015 at 10:11 AM

    I believe that you must issue the command to the questions since the above is changing the properties of the form, not of the fields, so this would be the correct link:

    PUT /form/{id}/questions

    I would however recommend taking a look at our developers forum instead since they would be able to explain this better there plus this is a forum for issues with our online JotForm Builder only.

    Thank you.