I don't know. I have multiple fields calculating based on the results of other fields and in order to get them to calculate I have to enter a value in other fields to force them to calculate.
My first field, "Strength" requires a user input.
My next field, "Ability_Mod_STR", displays a result based on value in "Strength".
My third field, "Ability_STR_ModLevel", displays the total of result from "Ability_Mod_STR" plus another field.
Then another field, "Fort_Ability" compares the values of "Ability_STR_ModLevel" and "Ability_CON_ModLevel" and displays the higher value or one if equal.
In order for these fields to do their thing, I have to manually enter values in other fields on the form, then they calculate. Here is the code I hacked from scripts I found here and elsewhere.
FIELD: Ability_STR_ModLevel
var Mod = Number(this.getField("Ability_Mod_STR").value); var Level = Number(this.getField("Init_Level").value); var Score = Mod+Level; event.value = Score;
FIELD: Fort_Ability
var STR = Number(this.getField("Ability_STR_ModLevel").value); var CON = Number(this.getField("Ability_CON_ModLevel").value); if( STR > CON) { event.value = STR; } else if(STR == CON) { event.value = STR; }
Is it something I did wrong or a setting I'm missing for calculations.
Thanks in advance,
Jim
It's not clear to me what problem you're having. Perhaps the field calculation order is wrong. If it's not behaving how you expect, please explain exactly how you expect it to behave.
That last bit of code does not seem complete. Did you leave something off? If not, can you clarify what you want the value to be if CON is greater than STR?
George