Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

Adobe Acrobat Does Not Show Selection

Community Beginner ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

I am having issues with an Adobe Acrobat pdf. The JavaScript that I have is working correctly for what I am doing which is making a dynamic D&D 5e Character Sheet. I have checked the spelling and it's all correct. There's no issues with punctuation, or capitals either. Everything is as it should be.

 

The way this is supposed to work is when I select a Class from the Class1 drop-down, the appropriate checkboxes should be checked (marked true). When I enter the level of the class, the SubClass drop-down shows the available sub classes if the level is high enough. If the sub class chosen adds more proficiencies, those checkboxes and/or proficiency text field displays the correct items the character is proficient with. If the character is a multi-class character and selects another class after the primary class chosen, the script adds the new proficiencies based on the rules in the 2014 Player's Handbook, Tasha's and Xanathar's books.

 

Every single class works as intended based on this script I'm about to show you. All except the Cleric and its Subclasses. When I select Cleric or its subclasses that add proficiencies no change on the character sheet occurs. The proficiency checkboxes remain blank. If I choose another class first in the Class dropdown box, let's say I select Barbarian, it highlights correctly; but if I then change it from Barbarian to Cleric, the Barbrian proficiency checkboxes and text field remain the same as showing the Barbarian proficiencies. I have run debugging tests and it shows that the form is recognizing Cleric and the SubClasses and its level as intended. It just refuses to turn on the correct proficiency checkboxes. 

 

Here is the script and I have attached the document I am working on. What is going wrong?


Correction: Apparently I can't just copy/paste a JavaScript here, so please see the script under the Calculation Field in the Proficiency text field on the second page. The drop down lists are at the top of the first page. 

TOPICS
JavaScript , PDF , PDF forms

Views

141
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

'includes' will not work in Acrobat, use indexOf()

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

Thank you. As soon as I get home I will try that.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

There are errors displayed in the Console Window for all selections.  The "Cleric" selection has the additional error that Nesa pointed out. But you should always check the console first and fix those errors. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

As you can probably tell I am not educated on the ways of JavaScript, and am using AI to try and get what I want. I just used simple script to get it working roughly the way I wanted. Now with AI I am trying to unlock all the options JavaScript can do. 

When you say Console Window I am not entirely sure what you're talking about.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Expert ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

The Console is displayed by pressing Ctrl-J.

See this video:

https://www.pdfscripting.com/public/images/video/AcroJSIntro/AcroJSIntro_ConsoleWindow.cfm

 

AI will screw you. It is the worst possible way to write a script.  All it does is cobble together random crap from the web. Whereas the helpful experts on this forum, and others, actually know what they are doing and test code before providing it. 

Don't ever ask someone here to fix crap from an AI. 

 

Thom Parker - Software Developer at PDFScripting
Use the Acrobat JavaScript Reference early and often

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
Community Beginner ,
Feb 14, 2025 Feb 14, 2025

Copy link to clipboard

Copied

LATEST

Ahh...okay, ty. I'll start using that instead.
Considering that I don't know coding at all (I get lost working the apps on my iPhone), I feel like I need to pay someone to make this. Otherwise, I'd just be making a new forum post having people do the coding for me for free and I don't see how that's necessarily fair. I want to create this this, but have little time to sit down and figure out JavaScript to do it. That's why I felt like AI might be a blessing, but clearly it is not.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines