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

focus/blur

Explorer ,
Sep 08, 2020 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?

TOPICS
Acrobat SDK and JavaScript

Views

453

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

correct answers 1 Correct answer

Community Expert , Sep 08, 2020 Sep 08, 2020

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
Community Expert ,
Sep 08, 2020 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
community guidelines
Explorer ,
Sep 08, 2020 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
community guidelines
Community Expert ,
Sep 08, 2020 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
community guidelines
Explorer ,
Sep 08, 2020 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
community guidelines
Community Expert ,
Sep 08, 2020 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
community guidelines
Explorer ,
Sep 08, 2020 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
community guidelines
Community Expert ,
Sep 08, 2020 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
community guidelines
Explorer ,
Sep 08, 2020 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
community guidelines
Community Expert ,
Sep 08, 2020 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
community guidelines
Community Expert ,
Sep 08, 2020 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
community guidelines
Explorer ,
Sep 08, 2020 Sep 08, 2020

Copy link to clipboard

Copied

LATEST

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
community guidelines