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

69

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

Copy link to clipboard

Copied

Where does you use the script?

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
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.

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

Copy link to clipboard

Copied

Use the mouse and the script will run.

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
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.

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

Copy link to clipboard

Copied

Use a modified script at box labeled "BC".

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
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?

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
Adobe Community Professional ,
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.

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 ,
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.

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
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?

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
Adobe Community Professional ,
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.

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

Copy link to clipboard

Copied

How would I make that fit then? 

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

Copy link to clipboard

Copied

LATEST
mg3733479@gmail.com

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