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

Checking "Box 1" checks boxes "2", "3", etc and runs associated scripts

New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Hey there folks, to start off I'm brand new to Adobe Acrobat and all things JavaScript. Working on a project right now where I'm attempting to use JavaScripts to streamline the overall form. The area in question right now is a checkbox for showing additional fields to enter data. I've set it up do checking the inital box labeled "BC" will check to additional boxes "SerialID Row" and "RowExt". The script is set up as follows currently.

this.getField("SerialID Row").value = event.target.value;

this.getField("SerialID Row").readonly = (event.target.value == "Yes");

this.getField("RowExt").value = event.target.value;

this.getField("RowExt").readonly = (event.target.value == "Yes");

The issue is while this does check and uncheck "SerialID Row" and "RowExt" it dosen't run those checkboxes' respective scripts. Those scripts are set up as follows. With the only difference being in the names for getField.

var checkbox = this.getField("SerialID Row")
var dropdowns = []
var num = 76

for (i = 1; i <= num; i++)
dropdowns[i] = this.getField("SerialID Row" + i)

if (checkbox.value == "Off") {
for (i = 1; i <= num; i++)
dropdowns[i].readonly = true
} else {
for (i = 1; i <= num; i++)
dropdowns[i].readonly = false
}

I'm not sure where to go from here and don't know enough to try and interpert similar solutions to this issue. Any help or direction would be appreciated. As an FYI this is being done on Adobe Acrobat X Pro version 10.1.16 in case that matters. Thanks again in advance.

TOPICS
Create PDFs , General troubleshooting , How to , JavaScript , PDF forms

Views

573

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Where does you use the script?

Votes

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
New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

All three are in a checkbox under the action tab with a Mouse Up Trigger.

Votes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Use the mouse and the script will run.

Votes

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
New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

The only options I have are Mouse Up, Mouse Down, Mouse Enter, Mouse Exit, On Focus, and On Blur.

Votes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

Use a modified script at box labeled "BC".

Votes

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
New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

I just attempted each variation of Up, Down,Enter,etc. for the "BC" checkbox and none of them continued the scripts in the "SerialID Row" or "RowExt". How else would I potentially be needing to be modifying that original "BC" script?

Votes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

You can't trigger any of the mouse-related actions using another script. If you need to execute the same code then put it in a doc-level function and call it from both locations.

Votes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

I think the problem maybe that you think of the scripts you have as triggered "when the field is changed". But there is no such trigger. You have mouse up or mouse down, and it triggers only the current field. If you want indirect results, you have to run them yourself.

Votes

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
New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

@try67 and @Test Screen Name, how would I set up a doc-level function then to get those indirect results? On the other hand, is there a way to better script the intial "BC" checkbox to run those second level scripts and forgo the additonal checkboxes entirely?

Votes

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 ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

You can use the second level script at "BC". But you must modify this script.

Votes

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
New Here ,
Aug 02, 2022 Aug 02, 2022

Copy link to clipboard

Copied

How would I make that fit then? 

Votes

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 ,
Aug 05, 2022 Aug 05, 2022

Copy link to clipboard

Copied

LATEST
mg3733479@gmail.com

Votes

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