Skip to main content
Inspiring
February 24, 2024
Answered

copy function

  • February 24, 2024
  • 1 reply
  • 971 views

Hi
Please, can anyone help me solve this question?
I created this js acrobat function

var s1=this.getField("RESIDENT IN").value;
var s2=this.getField("RESIDENT IN_2").value;
var a1=this.getField("VIA").value;
var a2=this.getField("VIA_2").value
var b1=this.getField("N").value;
var b2=this.getField("N_2").value;
var residence1=s1+a1+b1;
var residence2=s2+a2+b2;
if(residence2==residence1)event.value=this.getField("4").value;

I inserted this function in the calculation script of field 4_2

I would like that when field 4 is empty, you can freely write any text in field 4_2

This topic has been closed for replies.
Correct answer bebarth

Hi,

Try this condition instead of yours:

if (event.source && event.source.name=="4" && residence2==residence1 && this.getField("4").value!="") event.value=this.getField("4").value;

 @+

1 reply

bebarth
Community Expert
bebarthCommunity ExpertCorrect answer
Community Expert
February 24, 2024

Hi,

Try this condition instead of yours:

if (event.source && event.source.name=="4" && residence2==residence1 && this.getField("4").value!="") event.value=this.getField("4").value;

 @+

ENE5CD9Author
Inspiring
February 24, 2024

once I have inserted the formula suggested to you, I can write the text in field 4_2, but when I write a text in field 4, the latter is not copied into field 4_2

bebarth
Community Expert
Community Expert
February 24, 2024

... and residence2==residence1 in your example???

That's working find for me!

@+