Copy link to clipboard
Copied
This is for a rpg character sheet, and relates to spells..
There are 4 main types..
Arcane, Divine, Occult, Primal
And there's a list of speeps based on those 4 types.
The setup I'm thinking is..
1 checkbox for each of the 4 types
(So A, D, O, P)
I have a drop-down list of all spells by spell type
All in the same list.
So each spell would be titled
Something like....
Arcane magic middle.
What I want to happen is when the box for say Arcane is checked, the list only shows items with "Arcane"
Any help with this is appriciated
Copy link to clipboard
Copied
So you want to filter the list of the drop-down items based on the selections in the check-boxes, basically?
To do that you would need to use a script that keeps an internal copy of the full list, or another field (could be hidden) with the full list from which to copy the values to the visible field.
Copy link to clipboard
Copied
I can make the list a separate hidden list..
But don't know how to do the script..
I'm not good a javascript
Copy link to clipboard
Copied
So you want to filter the list of the drop-down items based on the selections in the check-boxes, basically?
Basiclly yes but no clue how to do it
Copy link to clipboard
Copied
Here's a simple example:
var listArcane = ["Item 1", "Item 2", "Item 3"];
var listDivine = ["Item 5", "Item 6"];
var listOccult = [ ... ]; // fill in the blanks
var listPrimal = [ ... ];
var finalList = [""];
if (this.getField("Arcane").valueAsString!="Off") finalList = finalList.concat(listArcane);
if (this.getField("Divine").valueAsString!="Off") finalList = finalList.concat(listDivine);
if (this.getField("Occult").valueAsString!="Off") finalList = finalList.concat(listOccult);
if (this.getField("Primal").valueAsString!="Off") finalList = finalList.concat(listPrimal);
this.getField("Combined Spells").setItems(finalList);
The main question is where to place this code, ie what will trigger it. One way of doing it is by adding an "Update spells list" button that will execute this code to update the combined list based on the selected check-boxes. Other ways are also possible, but will require tweaking it a bit.
Copy link to clipboard
Copied
Not sure about how to do an spell update button..
But for the first 4 lines .
Each of the four lists are very long (broken up levels)
Is there a quicker way to add them besides typing each item one by one?
Copy link to clipboard
Copied
If you have fields that contain the lists then you can read the options from those lists.
It's also possible to read the data from a text file that you attach to the PDF, but that's more complicated to implement.