Complicated Form Idea With Adding Calculation Problem. - RESOLVED

  • AA_C
    Asked on November 26, 2016 at 4:06 PM

    Hi,

    I may be going about this form problem in a way that is not the best. (63295133118958)

    I'm attempting to use "TEXT" option and edit the html to suite my needs.

    I create required fields then copy that field code into the TEXT html 

    So far I have been successful but now I have a problem doing a simple calculation.

    The Qty Column has two inputs, one for M and one for W.

    I want to add the input values in these fields and then multiply by the unit cost.

    I'm using the calculator but I'm not getting a value in the total that makes any sense.

    Also it should show two decimal places.

     

    Perhaps you could offer a different method for creating this form.

    Here is an image of what I'm looking for.

    Thanks

    Robert

    Complicated Form Idea With Adding Calculation Problem Screenshot 20

  • Elton Support Team Lead
    Replied on November 26, 2016 at 8:15 PM

    I see that you are using table. In order for your calculation to work, you must add the calculatedOperand class and the field ID on the td tag where the source fields are.

    Example for the Q quantity field: The highlighted parts are the most crucial parts in order to get the calculation to work.

    Complicated Form Idea With Adding Calculation Problem Screenshot 20

    Demo: https://www.jotform.com/63307994605968

    Hope this helps!

  • AA_C
    Replied on November 27, 2016 at 6:15 AM

    Hi Elton,

    Yes this is very helpful indeed. I cloned your form and it is working. Now I will attempt to add all the required inputs and calculations. I Assume I need a separate hidden calculation functions for each field that requires a calculation.

    Note: The bottom of the form below the table I used as a sketch pad for creating my inputs, then copying the id's to the table, Question, after I have all my inputs identified and working in the table can I safely delete the bottom inputs etc. ? I will keep all the hidden calculation fields.

    I hope I'm clear, I have a tendency to ramble on.

    many thanks,

    Robert

  • AA_C
    Replied on November 27, 2016 at 8:40 AM

    I must be close with my calculations but it is acting very strangely.

     

    1. ERROR1 If a value of 1 QTY is entered for either M or W of the first item the total populates all my total fields.

    2. If I don't enter any value for item 1 my fields appear to function almost correctly.

    3. ERROR2 If I enter a QTY in both boxes of item 2 only the M value is calculated.

    4. Items 3 to 5 all appear to function correctly. 

     

    I'm at a loss as to my errors???? Please Help

    Thanks Robert

  • AA_C
    Replied on November 27, 2016 at 11:35 AM

    HI AGAIN,

    I deleted all the fields below the table. The table calculations are still not working as they should.

    I added new fields below the table to test calculations. As in the table the first Quantity inputs are creating values in all 5 total. This only occurs with the first row, the other rows all respond as they should as dose the subtotal and tax calculation...... What am I missing here for the first calculation that it interferes with all the rest?

    I'm on a bit of tight schedule here so that is why I keep posting questions.

    Many thanks JF,

    Robert

  • Charlie
    Replied on November 27, 2016 at 11:53 AM

    Hi,

    I'm still checking the form, although I do not recommend this kind of setup as it might easily break. 

    I'll get back to you the soonest. 

  • AA_C
    Replied on November 27, 2016 at 12:05 PM

    I tend to agree... It gets messy... Thanks... Perhaps I should rethink the process.

  • Charlie
    Replied on November 27, 2016 at 12:14 PM

    Hi again,

    See if my form works as you expected: https://form.jotform.com/63313718050953. You can clone it to see how I set it up.

    What I did:

    1. I used text boxes and conditional logic for the sub totals. 

    2. I removed the "calculateOperand" because it is added as a class, which means it is applied to all elements that has that class name, in your case all sub totals will have the same value.

     

    I hope that helps. Although I still don't recommend this personally for the following reasons:

    1. It is hard to maintain or make changes because we're dealing on referencing form fields to your raw HTML fields.

    2. There's a chance that a slight update may break the referencing (but this is quite unlikely unless you are referencing a widget). I'm using simple text boxes for the totals so it is highly unlike that the unique name or field IDs will change because of an update.

     

    I hope that helps. 

  • AA_C
    Replied on November 27, 2016 at 1:12 PM

    Thanks a bunch Charlie... Works now...

    Can I delete all the fields below the table? SORRY I see how you are calculating and need them, I will hid these

  • Welvin Support Team Lead
    Replied on November 27, 2016 at 3:26 PM

    That's great to know.

    You can delete the fields if they are not in used. If they are, you can just hide them. 

    Please contact us again if we can help in any way.

  • AA_C
    Replied on November 27, 2016 at 6:52 PM

    OK... Getting there ... How do I get the values to show two decimal places? 

  • Chriistian Jotform Support
    Replied on November 27, 2016 at 8:45 PM

    To get the value to show 2 decimal places, simply open your conditions wizard for the specified field and follow the steps below.

    1. Click the ... button to show the additional options

    Complicated Form Idea With Adding Calculation Problem Screenshot 40

    2. Then select the Options tab and check the "Show empty decimal places" checkbox.

    Complicated Form Idea With Adding Calculation Problem Screenshot 51

    Do this for all the conditions and it should now show two decimal places.

    Complicated Form Idea With Adding Calculation Problem Screenshot 62

    If you need further assistance, please let us know.
    Regards.

  • AA_C
    Replied on November 29, 2016 at 9:35 PM

    Thanks, that worked, helps with French prices also, nice fix.

    So far so good... Marching on.... But!

    If I have conditions on one page and try to use them on another, should they work?

    I created two pages for this form, Page 1 had all the conditions and the form, Page 2 had the same form only in French but no conditions. It wouldn't work. 

    I had tried using radio buttons to select Page 1 or Page 2, Selecting page 1 worked Page 2 failed.

    How would I get the conditions to work on both forms?

  • BJoanna
    Replied on November 30, 2016 at 2:18 AM

    Form with ID 63295133118958 that you provided on this thread has only one page. Are you working on some other form? If so, please provide us ID of that form. 

    I'm not sure how your conditions were set, but they should work on another page as well.

    I also think that you should open new thread, because it seems that your issue with conditions is not related to subject of this thread. This way we can avoid confusion. 

  • AA_C
    Replied on November 30, 2016 at 6:40 AM

    Hi,

    Sorry, I had tried this on an earlier version, and later deleted it so my question was rhetorical. You have answered my question and I appreciate the feedback. I was thinking any issue with this form was related, again sorry.

    Regards
    Robert
    AAC

  • Elton Support Team Lead
    Replied on November 30, 2016 at 7:11 AM

    No worries, Robert. :)

    Since this thread was about calculation issue on text HTML field, I have moved your conditions question to a separate thread here https://www.jotform.com/answers/1000604. We'll be on this thread shortly.