0

I am making an automated PDF character sheet. I want it so when a player selects an armor from a drop down list, a radio button selects telling the player what type of armor they have selected.

I would just have it say the words, but the aesthetics are important.

  • I don't know how to get a Calculate option to show up on radio buttons to be able to program them to begin with. I don't have coding yet because I don't know how to get there. Which is why I was asking if it is at all possible. I only just got the program yesterday and I have almost no experience programing. What experience I do have is all self taught in MS Excel. Which I know isn't really programming. – David McLees Sep 18 '22 at 15:29

1 Answers1

1

I figured out a method of making it work. I was originally trying to put the code in the radio boxes because I am used to doing code in Excel. I am very inexperienced with programming. I got it to work by putting the code in the "combo box properties." The hardest part was finding the syntax. I really wish I could find a syntax cheat sheet for foxit's javascript.


var Armor = this.getField("ArmorName");
var a0 = this.getField("ArmorButton0");
var a1 = this.getField("ArmorButton1");
var a2 = this.getField("ArmorButton2");

if(Armor.value == 'Nylon'){
a0.checkThisBox(0,true);
a1.checkThisBox(0,false);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Kevlar'){
a0.checkThisBox(0,true);
a1.checkThisBox(0,false);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Liquid'){
a0.checkThisBox(0,true);
a1.checkThisBox(0,false);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Soft Carbon Fiber'){
a0.checkThisBox(0,true);
a1.checkThisBox(0,false);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Nano Cloth'){
a0.checkThisBox(0,true);
a1.checkThisBox(0,false);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Treaded Rubber'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,true);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Faceted Rubber'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,true);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Chain'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,true);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Dragon Skin'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,true);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Gel-Composite'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,true);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Shock'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,true);
a2.checkThisBox(0,false);
} else if (Armor.value == 'Poly Plate'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,false);
a2.checkThisBox(0,true);
} else if (Armor.value == 'Ballistic Poly'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,false);
a2.checkThisBox(0,true);
} else if (Armor.value == 'Alloy'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,false);
a2.checkThisBox(0,true);
} else if (Armor.value == 'Ceramic Plate'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,false);
a2.checkThisBox(0,true);
} else if (Armor.value == 'Hardened Carbon Fiber'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,false);
a2.checkThisBox(0,true);
} else if (Armor.value == 'Plate Tonic'){
a0.checkThisBox(0,false);
a1.checkThisBox(0,false);
a2.checkThisBox(0,true);
}

I might be able to cut the code on it a lot but right now I am just happy it works.