Javascript Limitations - How many lines can a PDF handle?

Community Beginner ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

Wanting to control radio buttons associated with a text field entry, this I was able to get working thanks to some help from another thread.

(https://community.adobe.com/t5/acrobat-discussions/toggle-a-radio-button-when-a-text-field-value-is-...)

 

The issue is that each text field has 10 radio toggles (0-9) per field, when it comes to the 4th text field the data I had originaly entered had been replaced with data from one of the previous text field entries. This in turn produced the error 'Invalid value: must be less than or equal to 0.' while testing the form. I tried searching for an answer but wasn't able to locate anything that fit my scenario.

 

Running this coede in each text fields Validate section

 

     this.getField("Radio Button").value = event.value == "0" ? "Choice1" : "Off";

     ...

     this.getField("Radio Button").value = event.value == "9" ? "Choice1" : "Off";

 

js error.png

 

 

Perhaps there is a different/better way to tackle this?

TOPICS
Create PDFs , Edit and convert PDFs , General troubleshooting , JavaScript , PDF forms

Views

101

Likes

Translate

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
LEGEND ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

What message do you get when testing it in Acrobat?

Likes

Translate

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 ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

Actually nothing works. I am using Acrobat Pro DC so when in the preview mode none of the scripting is working but does when you open the file in a browser. When I look at the Preferences Adobe the 'Enable Acrobat JavaScript' is enabled, unless I am missing some other setting.

Likes

Translate

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 ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

Look for errors in the Acrobat Javascript console.

Likes

Translate

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 ,
Apr 10, 2022 Apr 10, 2022

Copy link to clipboard

Copied

I was able to figure out CTRL+J opens the console, however I was not able to see any errors other than the fact that the 4th column was the one giving me trouble. Must have been a syntax error I kept missing, so I reentered the data and that solved my problem.

 

I am not a programmer, however I am learning a lot. Thank you for your help.

Likes

Translate

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 ,
Apr 18, 2022 Apr 18, 2022

Copy link to clipboard

Copied

LATEST

Was able to figure it out, thank you for tour assistance.

Likes

Translate

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