Highlighted

focus/blur

Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

On buton field I use focus/blur to show/hide text field1, on my field2 I set up code if field1 is visible ,field2 show some text, but "on focus" doesn't count field1 as visible. Is there way to fix that?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

But you're not using a script... Use this code:

 

// Mouse Enter

this.getField("Text2").display = display.visible;
this.getField("Text3").value = "Text";

 

// Mouse Exit

this.getField("Text2").display = display.hidden;
this.getField("Text3").value = "";

Topics

Acrobat SDK and JavaScript, How to

Views

65

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

focus/blur

Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

On buton field I use focus/blur to show/hide text field1, on my field2 I set up code if field1 is visible ,field2 show some text, but "on focus" doesn't count field1 as visible. Is there way to fix that?

Most Valuable Participant
Correct answer by try67 | Most Valuable Participant

But you're not using a script... Use this code:

 

// Mouse Enter

this.getField("Text2").display = display.visible;
this.getField("Text3").value = "Text";

 

// Mouse Exit

this.getField("Text2").display = display.hidden;
this.getField("Text3").value = "";

Topics

Acrobat SDK and JavaScript, How to

Views

66

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
Adobe Community Professional ,
Sep 08, 2020

Copy link to clipboard

Copied

Share your script, where are you running it from?

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...
Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

Hi, just to correct mistake, it's not on focus/blur it's on Mouse enter/exit.

I use code in field2 as custom calculation script, it works if I change code to hidden but it doesn't work for visible.

var a = this.getField("Text2");
if (a.display = display.visible){
event.value = "text";}
else event.value = "";

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...
Most Valuable Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

Change:

if (a.display = display.visible){

To:

if (a.display == display.visible){

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...
Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

Sorry that was just typo.

Here is my file if you want to look at it. https://drive.google.com/uc?export=download&id=1IqQzEPVskAQl68ZmN4JcJ34wcPGKyXo3

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...
Most Valuable Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

There's no code in this file, and the show/hide functions seem to work just fine.

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...
Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

Code is in Text3 field, custom calculation 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...
Most Valuable Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

Ah, I see... The issue is that entering and existing a field is not an event that triggers calculations, so the code never runs. You should do it in the Mouse Enter/Exit events of the button field, instead.

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...
Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

I do use mouse enter/exit you can see it in button field action tab.

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

Copy link to clipboard

Copied

I tried that suggestions too and I 'm not able to work around it either

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...
Most Valuable Participant ,
Sep 08, 2020

Copy link to clipboard

Copied

But you're not using a script... Use this code:

 

// Mouse Enter

this.getField("Text2").display = display.visible;
this.getField("Text3").value = "Text";

 

// Mouse Exit

this.getField("Text2").display = display.hidden;
this.getField("Text3").value = "";

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...
Blaž LATEST
Community Beginner ,
Sep 08, 2020

Copy link to clipboard

Copied

Thank you so much.

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...
Resources
One Stop Solution for Acrobat
Edit a PDF