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

focus/blur

Explorer ,
Sep 08, 2020 Sep 08, 2020

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
1.9K
Translate
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 = "";

Translate
LEGEND ,
Sep 08, 2020 Sep 08, 2020

Share your script, where are you running it from?

Translate
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

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 = "";

Translate
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

Change:

if (a.display = display.visible){

To:

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

Translate
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

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

Translate
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

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

Translate
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

Code is in Text3 field, custom calculation script.

Translate
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

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.

Translate
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

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

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

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

Translate
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

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 = "";

Translate
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
LATEST

Thank you so much.

Translate
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