Javascript Enable/disable all buttons

Community Beginner ,
Apr 08, 2022 Apr 08, 2022

Copy link to clipboard

Copied

Hi, I have an interactive PDF made with indesign (with buttons that show/hide other buttons). My client want to be able to enable or disable the buttons with one button (or two, maybe radio button?) on the first page of the PDF. Is there a way to do that?
*Note that I have an «Hidden until trigerred» function on some of my buttons.

Thank you!

TOPICS
JavaScript

Views

95

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

Copy link to clipboard

Copied

I wonder, if they were on a layer and your 'switch' turned on/off the visibility of the layer.... could that do the trick?

 

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

Copy link to clipboard

Copied

Thank you for your answer!!!
it look like a really good idea 🙂
I check with my client if this is suitable for him, as this PDF will be opened by professors or students on different platforms.
Thanks again!!

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

Copy link to clipboard

Copied

Yes, this can be done with a script. You just need a list of the field names, and then to iterate over them in a loop, changing their display property from visible to hidden, or vice versa.

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

Copy link to clipboard

Copied

Place this script as a Mouse up action in a checkbox (not in a radio button):

 

if (event.target.value != "Off") {
for (var i = 0; i < this.numFields; i++) {
var oFld = this.getField(this.getNthFieldName(i));
if (oFld.type == "button" && oFld.page == 0) {
oFld.readonly = true;
}
}
}
else {
for (var i = 0; i < this.numFields; i++) {
var oFld = this.getField(this.getNthFieldName(i));
if (oFld.type == "button" && oFld.page == 0) {
oFld.readonly = false;
}
}
}

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

Copy link to clipboard

Copied

LATEST

Thank you!! 🙂
it didn't work at first, but by removing « && oFld.page == 0» it works great!

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