!!! Recalculation without infinite loop !!!

!!! Recalculation without infinite loop !!!

Hi there,

I have build a simple calculator which calculates some plastic specifications called MFI (each has got min and max, compare the screenshot). There are 3 different types of MFI (Melt flow index) MFI 2, MFI 5 and MFI 21 / HLMI. I have got all the functions to calculate each of these types, if you have got one of them given.




The aim: If you type in a  value in one of the fields, all the other fields should be calculated automatically. So far so good.

The problem: If you change one of the values, the system do not recalculate the other values. I just build a "reset" button to solve the problem. Does anybody has a nicer approach? 


All the calculation are in the specific on user input area of each field. I.E.: MFI 2 min:

  1. if (input.calc  =  "Berechnen")
  2. {
  3.     if (input.MFI_5_min  =  null) // this prevent the infinite loop
  4.     {
  5.         input.MFI_5_min = (input.MFI_min  *  4.5);
  6.     }
  7.     if (input.HLMI_bis  =  null)
  8.     {
  9.         input.HLMI_bis = (input.MFI_min  *  100);
  10.     }
  11. }
The calc field with " berechnen " is for the reset button:

  1. if (input.Reset1  =  "Reset")
  2. {
  3.     calc.deselect("Berechnen");
  4.     input.MFI_min = null;
  5.     input.MFI_max = null;
  6.     input.MFI_5_min = null;
  7.     input.MFI_5_max = null;
  8.     input.HLMI_bis = null;
  9.     input.HLMI_max = null;
  10. }
  11. if ((input.HLMI_bis  =  null)  ||  (input.HLMI_max  =  null)) // this is just to check if the reset is done
  12. {
  13.     input.calc = "Berechnen";
  14.     Reset1.deselect("Reset");
  15. }


My approach: I have to indicate if you type in a new value in one of the fields, and then the others should be 1. reseted and 2. recalculated.


Has anybody an approach how to implement this into zoho?

THANKS!