Copy link to clipboard
Copied
I have one other type of field I am trying to make work, but it comes from a possibility of 4 different answers.
If they select one trait they get one result, another gets a different result and no trait gets no result. I can't remember how to do an array and I seemed to remember you could nest ifs. This is what I came up with:
var IntMod = Number(this.getField("IntMod").value);
var WisMod = Number(this.getField("WisMod").value);
var ChaMod = Number(this.getField("ChaMod").value);
if(this.getField("Ability").value != "Wisdom"){
event.value = WisMod + 10;}
Else
if(this.getField("Ability").value != "Charisma"){
event.value = ChaMod + 10;}
else
if(this.getField("Ability").value != "Intelligence"){
event.value = IntMod + 10;}
else
event.value = 0;
Thank you for your help. It has been a while.
Regards,
Larry
Hi, javascript is case sensitive so in your code first 'Else' should be 'else'.
If you try add +10 to 'WisMod' field if value is 'Wisdom' then you need to use '==' not '!=',
'!=' that means value is not 'Wisdom', and '==' means value is 'Wisdom'.
Hope thats what you looking for 🙂
Copy link to clipboard
Copied
Hi, javascript is case sensitive so in your code first 'Else' should be 'else'.
If you try add +10 to 'WisMod' field if value is 'Wisdom' then you need to use '==' not '!=',
'!=' that means value is not 'Wisdom', and '==' means value is 'Wisdom'.
Hope thats what you looking for 🙂
Copy link to clipboard
Copied
Thanks again for all your help. Like I said been a while since I used javascript here.