Skip to main content
Participant
June 7, 2018
Question

Making a "text2" override "text1" in Acrobat

  • June 7, 2018
  • 1 reply
  • 639 views

Hi guys,

Thanks for any help, I'm AWFUL with javascript and i've been scratching my head on this.

I'm trying to figure out the right script for making text box tiers essentially.

"Text1" is the lowest tier, and the last wanted option.

"Text2" is the preferred information.

I want to make it so that "Text3" shows "Text2", but if it's not available, "Text1" fills it in.

I've minimal to no javascript experience, so help with this is greatly appreciated!! I understand how to implement it for the most part under "Actions".

Thank you!!!

This topic has been closed for replies.

1 reply

try67
Community Expert
Community Expert
June 7, 2018

Use this code as your field's custom calculation script:

var v1 = this.getField("Text1").valueAsString;

var v2 = this.getField("Text2").valueAsString;

event.value = (v2=="") ? v1 : v2;

uxsurperAuthor
Participant
June 7, 2018

Hmm, it's not working for some reason?

I ran it as a javascript, mouse up on all three text boxes.

Text 3 stays empty?

try67
Community Expert
Community Expert
June 7, 2018

No, as I wrote, this needs to be used as the custom calculation script (of Text3).