- NolasolAsked on November 26, 2014 at 07:37 AM
I have a question again :-)
How can I reset a calculated or updated by condition value in a field, if user would modify his/her previous selection?
Dropdown list with 2 options:
Two other dropdown lists, appears only one from them, depends on selection in 1.)
Dropdown list A (appears only if selection was BLUE):
DARK (calc. value: 1)
LIGHT (calc. value: 2)
Dropdown list B (appears only if selection was YELLOW):
ORANGE (calc. value: 3)
CITRINE (calc. value: 4)
Form calculation field, it's result is 'sum' of Dropdown A and B
If user first selects BLUE and then LIGHT, calculation field shows value 2.
If user then modifies the first selection to YELLOW, Dropdown A disappears and Dropdown B appears, but calculation field keeps the value as 2. If user selects CITRINE, calculation field will be updated to 6 instead of 4.
I know, I can set up a condition to calculation (if selection is BLUE, then calculation field is Dropdown A, if selection is YELLOW, then calculation field is Dropdown B etc.), but it is so difficult if the first dropdown list would include much more options than two. (In my case the number of options is 18, so I wouldn't like to set up a 18-item condition to update value of the last calculation field.)
Is there any method, option to reset a value if parent selection is modified?
I hope, my poor English is enough to understand my request :-)
- JotForm SupportWelvinAnswered on November 26, 2014 at 10:27 AM
I have created this form: http://www.jotformpro.com/form/43294284644966 to test if the function remains that way and you're correct. We used to reset field values before when it's hidden by conditional logic, but we have reverted it back for some reason.
A quick fix for that is to check "Ignore Hidden Fields" in the advance settings of the calculation widget:
This option will exclude fields from the calculation if it's hidden. And then for as long as you change the value from the dropdown field, the calculation triggers the correct result.
- NolasolAnswered on November 26, 2014 at 11:03 AM
it's great, and sorry, I didn't find this option until now :-)
It looks like working as I need!
- NolasolAnswered on November 26, 2014 at 11:19 AM
I tried it in my own form and doesn't work.
If I set up at last calculated field to 'Ignore hidden field', then it's value is always 0.
I can select BLUE or YELLOW and then any option in the dropdown list appeared, the result of this calculation is always zero.
If I uncheck this option, then calculation works again, but never reset itself if user changes his selection in first list, and I got an increased value with hidden and shown options as result.
Any idea? :-)
- JotForm SupportWelvinAnswered on November 26, 2014 at 11:44 AM
You are working of this form: 43233413574349, right? Unfortunately, your form structure isn't the same as mine. Based on your original post, you are showing/hiding field using conditional logic and calculation these fields.
However, you are calculating totals from all other calculation widgets to your form which is currently hidden by default. It's not a direct calculation of the used fields. Of course, they are ignored because they are hidden.
But not unless I'm looking to a different section of the form, then please tell me what are the correct fields and what calculation widget is used.
- NolasolAnswered on November 26, 2014 at 11:54 AM
Yes, I'm working on this form 43233413574349, and the calculated field is the 'Calculation' (input_105).
I'm using dropdown lists (total number will be 18), and only one dropdown list will appear, depends on a selection in a previous dropdown list.
These 18 dropdown lists have got may option (ie. 100-150/list!) and all options have got different calculation values.
Then I'd like to appear the final value in a shown field ('Calculation').
Now I set up calculations as a simple 'ADD' list, all of 18 dropdown lists. The problem is, when user reselect the first option, then an other 'child' dropdown list appears (and earlier dropdown will be hidden), but calculation doesn't 'forget' the previous value, and simple add to it the value of the new selection.
It's a malfunction of my form at this moment and I'd like to set it up to show only the calculation value of selection of the appeared dropdown list and forget any earlier values that became hidden already.
If here is not any solution, I have to set up a robust condition list to this calculation, line-by-line setting up 'IF ... selection ... then update value to child list 1..." and so on, dropdown-by-dropdown.
- JotForm SupportWelvinAnswered on November 26, 2014 at 12:42 PM
You mean this calculation, right? This...
The widget includes multiplication. When the rest of the fields are hidden - the field "Árfolyam:" is multiplied to "zero" so the result is expected to "zero".
But if "Spanyolországi település kiválasztása:" and "Ausztriai település kiválasztása:" fields are visible, then the result is correct.
What you need to do is to make sure there's at least a visible field when changing options from the previous fields. I understand what you are trying to have, but I'm a little bit confuse about the conditional logic. Particularly, on how to show the above mentioned fields. There are connecting fields. Can you please tell me what to select/choose from the previous fields? What fields are supposed to be in the calculation widget?
- NolasolAnswered on November 26, 2014 at 12:54 PM
yes, these fields are in focus now.
"Árfolyam:" (arfszorzo in calculation) is never zero (this is a currency converter related to Euro, and if selected currency is Euro, then its value is 1 - in other case the value is different but never zero).
es_indvaros is a dropdown list that includes spanish towns and appears only if 'indorszag' (departure country) is Spain.
at1_indvaros is a dropdown list that includes austrian towns and appears only if 'indorszag' is Austria (and here is an other condition also, because we touch Austria with two different lines, depends on arrival country an other dropdown list appears, name will be at2_indorszag).
If user selects 'Spain' as 'indorszag', then es_indvaros appears and user can select a spanish town as departure address. It contains a calculation value, that user can see in 'Calculation' field.
If user reselect the departure country from Spain to Austria, then es_indvaros dropdown will be hidden and at1_indvaros appears. Then user can select an austrian town as departure address.
In this case, I'd like to Calculation show only the value of last selection (calculation value of selected austrian town) and "forget" the value of previous, already invalid selection (value of spanish town). Now it isn't working. When user reselect the departure country, spanish dropdown disappears and austrian one is appears, but the calculation field keeps the previous value instead of be zero or value of new selection.
If I set up 'Calculation' to "Ignore hidden fields", then its value will be always zero.
Árfolyam (arfszorzo) isn't hidden, one of the dropdowns isn't hidden too, so I think calculation has to be work - but I see it doesn't work.
I feel I do something wrong :-) but can't find the exact place, where I do anything wrong :-)))
- JotForm SupportWelvinAnswered on November 26, 2014 at 01:29 PM
Found it! The following, let me know when I'm right (because you're talking of the field names) whereas I'm asking for field labels.
So, are these fields correct? I think, yes. I actually cloned your form remove all the page breaks and show all widgets so to know: http://www.jotformpro.com/form/43295009664964.
Can you walk me through to replicate the problem? What first to select, second, third and so on? We are there, but just wanted to make sure before I give you another solution.
- NolasolAnswered on November 26, 2014 at 01:53 PM
Thanks for your hard work! :-)
Yes, you found these fields.
As you see, now "Calculation" is working, it shows value "20" that is the value of city named "Adra" in Spain. You set "Melyik országban kezdődik..." (= Departure country) to "SPANYOLORSZÁG" (=Spain), so you can select a spanish town from dropdown list and see its value in "Calculation".
Now if you reselect your "Melyik országban kezdődik..." dropdown from "SPANYOLORSZÁG" to "AUSZTRIA", you'll see the "Spanyolországi település kiválasztása" dropdown will disappear and an other dropdown ("Ausztriai település kiválasztása" = Select an austrian town) will be appeared and you can select a town in Austria (i.e. Linz). Linz has got a value "75", but if you'd select it, you will see in "Calculation" field "95" instead of 75, because it contains previous value (20) and actual value (75) also. I need to be visible value of the actual selection only (75).
If I check the option in calculation window (of "Calculation" field) "Ignore hidden fields", it will show always zero. Any selection, any town in any country, the value will be zero.
Thanks for your investigation :-) and I hope you can give me a good idea, because I'm afraid to set up a robust, difficult condition to 'Calculation'. It's important to contain a correct value, because this field will be the part of the 'Total amount' at the end of the form...
- JotForm SupportWelvinAnswered on November 26, 2014 at 02:46 PM
Gotcha! Thanks, Noemi
But well, the method is working to this form: http://www.jotformpro.com/form/43295009664964 (without the page break and some of the calculation widgets are visible). Here's a quick screencast: https://shots.jotform.com/welvin/ss/2014-11-27_0333.swf
Here's another cloned of your form: http://www.jotformpro.com/form/43295738291969. Still, "Ignore Hidden Fields" is checked. The calculation is always zero which leads me to believe that the problem is a result of some of the hidden calculation widgets. Let me find a way to use this method without showing the hidden calc widgets. There should be a way. Otherwise, you will end up using the conditional logic method :(
- NolasolAnswered on November 27, 2014 at 05:03 AM
your work is really perfect, thank you for it!
Of course, I can wait you to find any method to me use it, instead of construct a robust condition.
Until you try to find a solution, I insert all of 18-19 dropdown lists and set up a difficult condition to 'Calculation' field, then step over this section, because the time is going and now this form has a "ready-to-use status" at about 15%.
If you would find a solution, I will reedit these fields and use that.
Thank you so much!
- JotForm SupportWelvinAnswered on November 27, 2014 at 12:22 PM
You are welcome. It's my pleasure. I've been working on the form, but not sure why it's working on a new form and not to your form. Maybe because of the widget. Will check for more and let you know. OR maybe, you can stick with the conditional logic method. I think that's the best way for now to keep the form up.
- NolasolAnswered on November 27, 2014 at 12:28 PM
really thanks to your work, time and energy :-)
I think my trouble hasn't be in main priority because I have got a solution with conditional logic method. I just wanted to avoid using it, because will be so robust - but will work :-)
Thanks for your help and I will set up tomorrow my conditions to 'Calculation' field.
(The number of dropdowns finally is 20... and I will duplicate them at 'Arrival country' section :-) - I hope, JotForm can handle my form :-) )
- JotForm SupportabajanAnswered on November 27, 2014 at 02:22 PM
Okay, thanks for updating us, Noemi.