Highlighted

Dynamically sel visibility of field

Explorer ,
Nov 01, 2020

Copy link to clipboard

Copied

I'm trying to get a field to become visible determined by a dorpdown menu selection. This is the basic locig I'm trying to get to work...

 

if (a == 1) {
this.getField("modInstructions").display = display.noPrint;
}
else { this.getField("modInstructions").display = display.hidden; }

 

The value of a returns either 1 or 0, which I have confirmed, but visibility of field modIntructions isn't being affected... I have the code under Calculate, so maybe this is the wrong place?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

It should work, then, but you can try replacing this:

this.getField("modInstructions").display

With this:

event.target.display

TOPICS
Create PDFs, PDF forms

Views

58

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

Dynamically sel visibility of field

Explorer ,
Nov 01, 2020

Copy link to clipboard

Copied

I'm trying to get a field to become visible determined by a dorpdown menu selection. This is the basic locig I'm trying to get to work...

 

if (a == 1) {
this.getField("modInstructions").display = display.noPrint;
}
else { this.getField("modInstructions").display = display.hidden; }

 

The value of a returns either 1 or 0, which I have confirmed, but visibility of field modIntructions isn't being affected... I have the code under Calculate, so maybe this is the wrong place?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

It should work, then, but you can try replacing this:

this.getField("modInstructions").display

With this:

event.target.display

TOPICS
Create PDFs, PDF forms

Views

59

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
Nov 01, 2020 0
Most Valuable Participant ,
Nov 01, 2020

Copy link to clipboard

Copied

No, this is possible, but where are you defining the value of the "a" variable?

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
Reply
Loading...
Nov 01, 2020 0
Explorer ,
Nov 01, 2020

Copy link to clipboard

Copied

The is value of 'a' is from an object. I confirmed that 'a' is being set properly. It's being set to either 0 or 1.

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
Reply
Loading...
Nov 01, 2020 0
Adobe Community Professional ,
Nov 01, 2020

Copy link to clipboard

Copied

At what field 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
Reply
Loading...
Nov 01, 2020 0
Explorer ,
Nov 01, 2020

Copy link to clipboard

Copied

I put the code in the field I'm trying to set the visibility of.

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
Reply
Loading...
Nov 01, 2020 0
Most Valuable Participant ,
Nov 01, 2020

Copy link to clipboard

Copied

It should work, then, but you can try replacing this:

this.getField("modInstructions").display

With this:

event.target.display

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
Reply
Loading...
Nov 01, 2020 0
Explorer ,
Nov 01, 2020

Copy link to clipboard

Copied

Well, that worked. Not sure why the other way didn't, but such is life.

Thank you.

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
Reply
Loading...
Nov 01, 2020 0